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, Qt.TransformationMode.SmoothTransformation,
) )
self._thumb_opacity = 0.0 self._thumb_opacity = 0.0
self._fade_anim = QPropertyAnimation(self, b"thumbOpacity") anim = QPropertyAnimation(self, b"thumbOpacity")
self._fade_anim.setDuration(200) anim.setDuration(200)
self._fade_anim.setStartValue(0.0) anim.setStartValue(0.0)
self._fade_anim.setEndValue(1.0) anim.setEndValue(1.0)
self._fade_anim.setEasingCurve(QEasingCurve.Type.OutCubic) anim.setEasingCurve(QEasingCurve.Type.OutCubic)
self._fade_anim.start() anim.finished.connect(anim.deleteLater)
self._fade_anim = anim
anim.start()
def set_selected(self, selected: bool) -> None: def set_selected(self, selected: bool) -> None:
self._selected = selected self._selected = selected