grid: clean up QPropertyAnimation after fade completes

Connect finished signal to deleteLater so the animation object
is freed instead of being retained on the widget indefinitely.
This commit is contained in:
pax 2026-04-11 23:01:45 -05:00
parent b964a77688
commit 692a0c1569

View File

@ -106,12 +106,14 @@ class ThumbnailWidget(QWidget):
Qt.TransformationMode.SmoothTransformation,
)
self._thumb_opacity = 0.0
self._fade_anim = QPropertyAnimation(self, b"thumbOpacity")
self._fade_anim.setDuration(200)
self._fade_anim.setStartValue(0.0)
self._fade_anim.setEndValue(1.0)
self._fade_anim.setEasingCurve(QEasingCurve.Type.OutCubic)
self._fade_anim.start()
anim = QPropertyAnimation(self, b"thumbOpacity")
anim.setDuration(200)
anim.setStartValue(0.0)
anim.setEndValue(1.0)
anim.setEasingCurve(QEasingCurve.Type.OutCubic)
anim.finished.connect(anim.deleteLater)
self._fade_anim = anim
anim.start()
def set_selected(self, selected: bool) -> None:
self._selected = selected