]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/TabWidget.cpp
Add a background tab action to the context menu. https://redmine.stoutner.com/issues/949
[PrivacyBrowserPC.git] / src / widgets / TabWidget.cpp
index 3a1b54f33f2028f411b5eefadb14d346f794bb13..bd62f83beaa521343768bb9355fa3922359cd1f3 100644 (file)
@@ -141,7 +141,7 @@ void TabWidget::addFirstTab()
     tabWidgetPointer->currentWidget()->setFocus();
 }
 
-PrivacyWebEngineView* TabWidget::addTab(const bool focusNewWebEngineView)
+PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const bool backgroundTab)
 {
     // Create a privacy WebEngine view.
     PrivacyWebEngineView *privacyWebEngineViewPointer = new PrivacyWebEngineView();
@@ -334,11 +334,15 @@ PrivacyWebEngineView* TabWidget::addTab(const bool focusNewWebEngineView)
     // Set the spell check language.
     webEngineProfilePointer->setSpellCheckLanguages({QStringLiteral("en_US")});
 
-    // Move to the new tab.
-    tabWidgetPointer->setCurrentIndex(newTabIndex);
+    // Populate the zoom factor.  This is necessary if a URL is being loaded, like a local URL, that does not trigger `applyDomainSettings()`.
+    privacyWebEngineViewPointer->setZoomFactor(Settings::zoomFactor());
+
+    // Move to the new tab if it is not a background tab.
+    if (!backgroundTab)
+        tabWidgetPointer->setCurrentIndex(newTabIndex);
 
     // Clear the URL line edit focus so that it populates correctly when opening a new tab from the context menu.
-    if (focusNewWebEngineView)
+    if (removeUrlLineEditFocus)
         emit clearUrlLineEditFocus();
 
     // Return the privacy WebEngine view pointer.