1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 12:46:35 +01:00

Rework the zoom bug workaround

Qt 5.9 is affected too

Closes #2289
This commit is contained in:
David Rosca 2017-05-29 17:11:48 +02:00
parent 3ec6ffa5c9
commit 16f9b2fde9

View File

@ -40,7 +40,6 @@
#include <QDir>
#include <QTimer>
#include <QVersionNumber>
#include <QDesktopServices>
#include <QWebEngineHistory>
#include <QClipboard>
@ -160,15 +159,6 @@ 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();
@ -433,6 +423,11 @@ void WebView::slotLoadProgress(int progress)
if (m_progress < 100) {
m_progress = progress;
}
// QtWebEngine sometimes forgets applied zoom factor
if (!qFuzzyCompare(zoomFactor(), zoomLevels().at(m_currentZoomLevel) / 100.0)) {
applyZoom();
}
}
void WebView::slotLoadFinished(bool ok)