From a0e028a851b1e0f6fab146bb3fd97685473fa33b Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Sun, 11 Feb 2018 22:32:03 -0500 Subject: [PATCH] Update tab scroll position when finished loading. Resolves #3322 --- qutebrowser/browser/webengine/webenginetab.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 280c55c39..c30925372 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -26,7 +26,7 @@ import html as html_utils import sip from PyQt5.QtCore import (pyqtSignal, pyqtSlot, Qt, QEvent, QPoint, QPointF, - QUrl, QTimer) + QUrl) from PyQt5.QtGui import QKeyEvent from PyQt5.QtNetwork import QAuthenticator from PyQt5.QtWidgets import QApplication @@ -495,7 +495,7 @@ class WebEngineHistory(browsertab.AbstractHistory): self._tab.zoom.set_factor(cur_data['zoom']) if ('scroll-pos' in cur_data and self._tab.scroller.pos_px() == QPoint(0, 0)): - QTimer.singleShot(0, functools.partial( + self._tab.get_page().loadFinished.connect(functools.partial( self._tab.scroller.to_point, cur_data['scroll-pos'])) @@ -643,6 +643,9 @@ class WebEngineTab(browsertab.AbstractTab): self.zoom.set_factor(self._saved_zoom) self._saved_zoom = None + def get_page(self): + return self._widget.page() + def openurl(self, url): self._saved_zoom = self.zoom.factor() self._openurl_prepare(url)