Skip to content

Commit

Permalink
Consider default max width for toggle animation
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Oct 29, 2023
1 parent f9c2289 commit 378ffc6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qtanim/animations.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def changed(value: int):

animation.setEasingCurve(QEasingCurve.Type.InQuint)
animation.setStartValue(1)
animation.setEndValue(widget.sizeHint().width())
if defaultMaxWidth:
animation.setEndValue(min([defaultMaxWidth, widget.sizeHint().width()]))
else:
animation.setEndValue(widget.sizeHint().width())
animation.finished.connect(lambda: reset(hidden=False, defaultSize=defaultMaxWidth))
else:
widget.setDisabled(True)
Expand Down

0 comments on commit 378ffc6

Please sign in to comment.