grid: replace _source_pixmap with _source_path

Store the on-disk thumbnail path instead of a second decoded QPixmap
per ThumbnailWidget. Saves ~90 KB per widget in decoded pixel memory.
The source pixmap was only needed for the settings thumbnail-resize
path, which now re-decodes from disk (rare operation).

behavior change: thumbnail resize in settings re-reads from disk
instead of scaling from a held pixmap. No visual difference.
This commit is contained in:
pax 2026-04-11 22:40:49 -05:00
parent 3d288a909f
commit 738ece9cd5

View File

@ -74,7 +74,7 @@ class ThumbnailWidget(QWidget):
super().__init__(parent)
self.index = index
self._pixmap: QPixmap | None = None
self._source_pixmap: QPixmap | None = None # original, for re-scaling on size change
self._source_path: str | None = None # on-disk path, for re-scaling on size change
self._selected = False
self._multi_selected = False
self._bookmarked = False
@ -97,8 +97,9 @@ class ThumbnailWidget(QWidget):
self.setFixedSize(THUMB_SIZE, THUMB_SIZE)
self.setMouseTracking(True)
def set_pixmap(self, pixmap: QPixmap) -> None:
self._source_pixmap = pixmap
def set_pixmap(self, pixmap: QPixmap, path: str | None = None) -> None:
if path is not None:
self._source_path = path
self._pixmap = pixmap.scaled(
THUMB_SIZE - 4, THUMB_SIZE - 4,
Qt.AspectRatioMode.KeepAspectRatio,