From 7c776e24af8869336b90ce1ba38247f99e70d902 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Mon, 13 Apr 2026 23:42:55 +0200 Subject: [PATCH] fix: stash playlist scroll before video load, restore after Video load triggers layout changes (buttons, crop bar, preview window) that cause Qt to recalculate the playlist scrollbar position. Now saves the scroll value in _load_file and restores it at the end of _after_load. Co-Authored-By: Claude Opus 4.6 --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 0b1440e..5309718 100755 --- a/main.py +++ b/main.py @@ -2213,6 +2213,10 @@ class MainWindow(QMainWindow): self._lbl_file.setText(os.path.basename(path)) self.setWindowTitle(f"8-cut — {os.path.basename(path)}") _log(f"Loading: {os.path.basename(path)}") + # Stash playlist scroll — video load triggers layout changes that + # cause Qt to recalculate the scrollbar. + sb = self._playlist.verticalScrollBar() + self._playlist_scroll_stash = sb.value() if sb else 0 self._mpv.load(path) # _after_load triggered by MpvWidget.file_loaded signal @@ -2242,6 +2246,10 @@ class MainWindow(QMainWindow): self._spn_spread.setValue(float(self._settings.value("spread", "3.0"))) self._preview_win.show() self._preview_timer.start() + # Restore playlist scroll that video load disturbed. + sb = self._playlist.verticalScrollBar() + if sb and hasattr(self, '_playlist_scroll_stash'): + sb.setValue(self._playlist_scroll_stash) # Run DB fuzzy match off the main thread — can be slow on large databases. filename = os.path.basename(self._file_path)