]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/mainview.cpp
Add a zoom factor setting.
[PrivacyBrowserPC.git] / src / mainview.cpp
index a1e018b400734422350bbf1b8cf3c46d5ef88685..e46f00d1d6660f68a6d9140a2ca61121668015f8 100644 (file)
@@ -47,6 +47,9 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     connect(webEngineViewPointer, SIGNAL(loadProgress(int)), this, SLOT(updateUrlLineEdit()));
     connect(webEngineViewPointer, SIGNAL(loadFinished(bool)), this, SLOT(updateUrlLineEdit()));
 
+    // Set the zoom factor.
+    webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
+
     // Load a website.
     webEngineViewPointer->setUrl(QUrl(QStringLiteral("https://www.stoutner.com/")));
 }
@@ -60,5 +63,8 @@ void MainView::loadUrl(const QString &urlFromUser)
 void MainView::updateUrlLineEdit()
 {
     // Update the URL line edit.
-    urlLineEditPointer->setText(webEngineViewPointer->url().toString());
+    urlLineEditPointer->setUrl(webEngineViewPointer->url().toString());
+
+    // Reapply the zoom factor.  This is a bug in QWebEngineView that resets the zoom with every load.  Hopefully it will be fixed in Qt6.  <https://bugreports.qt.io/browse/QTBUG-51992>
+    webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
 }