fix: defer playlist scroll restore to next event loop iteration
Qt processes layout changes asynchronously, so restoring the scrollbar immediately after _after_load was too early. Use QTimer.singleShot(0) to restore after Qt finishes processing pending layout events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2246,10 +2246,9 @@ class MainWindow(QMainWindow):
|
|||||||
self._spn_spread.setValue(float(self._settings.value("spread", "3.0")))
|
self._spn_spread.setValue(float(self._settings.value("spread", "3.0")))
|
||||||
self._preview_win.show()
|
self._preview_win.show()
|
||||||
self._preview_timer.start()
|
self._preview_timer.start()
|
||||||
# Restore playlist scroll that video load disturbed.
|
# Restore playlist scroll after Qt processes pending layout events.
|
||||||
sb = self._playlist.verticalScrollBar()
|
if hasattr(self, '_playlist_scroll_stash'):
|
||||||
if sb and hasattr(self, '_playlist_scroll_stash'):
|
QTimer.singleShot(0, self._restore_playlist_scroll)
|
||||||
sb.setValue(self._playlist_scroll_stash)
|
|
||||||
|
|
||||||
# Run DB fuzzy match off the main thread — can be slow on large databases.
|
# Run DB fuzzy match off the main thread — can be slow on large databases.
|
||||||
filename = os.path.basename(self._file_path)
|
filename = os.path.basename(self._file_path)
|
||||||
@@ -2267,6 +2266,11 @@ class MainWindow(QMainWindow):
|
|||||||
self.statusBar().clearMessage()
|
self.statusBar().clearMessage()
|
||||||
self._timeline.set_markers(markers)
|
self._timeline.set_markers(markers)
|
||||||
|
|
||||||
|
def _restore_playlist_scroll(self) -> None:
|
||||||
|
sb = self._playlist.verticalScrollBar()
|
||||||
|
if sb:
|
||||||
|
sb.setValue(self._playlist_scroll_stash)
|
||||||
|
|
||||||
def _refresh_markers(self) -> None:
|
def _refresh_markers(self) -> None:
|
||||||
filename = os.path.basename(self._file_path)
|
filename = os.path.basename(self._file_path)
|
||||||
markers = self._db.get_markers(filename, self._profile)
|
markers = self._db.get_markers(filename, self._profile)
|
||||||
|
|||||||
Reference in New Issue
Block a user