mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Delay switch animation
If the switch triggers heavy GUI action, like a lot of paint()s, the concurrently running switch animation may look choppy. A small timer makes these events execute first and the animation will run smoothly afterwards when the event queue has been drained.
This commit is contained in:
parent
c8146c13c1
commit
fd4b5dc695
1 changed files with 2 additions and 1 deletions
|
@ -108,7 +108,8 @@ class Switch(QAbstractButton):
|
|||
animation.setDuration(100)
|
||||
animation.setStartValue(self.start_position)
|
||||
animation.setEndValue(self.end_position)
|
||||
animation.start()
|
||||
# make triggered events execute first so the animation runs smoothly afterwards
|
||||
QTimer.singleShot(50, animation.start)
|
||||
|
||||
def enterEvent(self, event: QEvent) -> None:
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
|
Loading…
Reference in a new issue