// Create the requsted window type.
switch (webWindowType) {
case QWebEnginePage::WebBrowserTab: {
- // Create the new tab and return the privacy WebEngine view pointer. It will then be populated with the link from the context menu.
- return browserWindowPointer->tabWidgetPointer->addTab();
+ // Create the new tab and return the privacy WebEngine view pointer. `true` removes the focus from the blank URL line edit.
+ // The new privacy WebEngine view pointer is returned so it can be populated with the link from the context menu.
+ return browserWindowPointer->tabWidgetPointer->addTab(true);
}
default: {
tabWidgetPointer->currentWidget()->setFocus();
}
-PrivacyWebEngineView* TabWidget::addTab()
+PrivacyWebEngineView* TabWidget::addTab(const bool focusNewWebEngineView)
{
// Create a privacy WebEngine view.
PrivacyWebEngineView *privacyWebEngineViewPointer = new PrivacyWebEngineView();
// Move to the new tab.
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)
+ emit clearUrlLineEditFocus();
+
// Return the privacy WebEngine view pointer.
return privacyWebEngineViewPointer;
}
public Q_SLOTS:
// The public slots.
- PrivacyWebEngineView* addTab();
void addCookieToStore(QNetworkCookie cookie, QWebEngineCookieStore *webEngineCookieStorePointer = nullptr) const;
+ PrivacyWebEngineView* addTab(const bool focusNewWebEngineView=false);
void applyApplicationSettings();
void applyDomainSettingsAndReload();
void applyDomainSettingsWithoutReloading(const QString &hostname);