From db33b8d860f70f9413d52c4f57450a02eacf9785 Mon Sep 17 00:00:00 2001 From: Anthony Fieroni Date: Mon, 8 May 2017 14:37:07 +0300 Subject: [PATCH] Workaround Qt5.8 zoom factor bug Signed-off-by: Anthony Fieroni --- src/lib/webengine/webview.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index 3f0863924..4ae93def1 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -154,6 +155,15 @@ void WebView::setPage(WebPage *page) // Set default zoom level zoomReset(); + static const bool zoomBug = QVersionNumber::fromString(qVersion()) < QVersionNumber(5, 9, 0); + if (zoomBug) { + connect(m_page, &WebPage::loadProgress, this, [this](int progress) { + if (progress > 0) { + applyZoom(); + } + }); + } + // Actions needs to be initialized for every QWebEnginePage change initializeActions();