From d455ccd1934478b66ff523db79319be4d43e6335 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Sun, 11 Jun 2023 23:30:34 +0200 Subject: [PATCH] AddressBar: Expand suggestion popup to the window Signed-off-by: Juraj Oravec --- src/lib/navigation/completer/locationcompleter.cpp | 5 +++++ src/lib/other/qzsettings.cpp | 1 + src/lib/other/qzsettings.h | 1 + src/lib/preferences/preferences.cpp | 2 ++ src/lib/preferences/preferences.ui | 7 +++++++ 5 files changed, 16 insertions(+) diff --git a/src/lib/navigation/completer/locationcompleter.cpp b/src/lib/navigation/completer/locationcompleter.cpp index 96fb97e2c..d07af975b 100644 --- a/src/lib/navigation/completer/locationcompleter.cpp +++ b/src/lib/navigation/completer/locationcompleter.cpp @@ -400,6 +400,11 @@ void LocationCompleter::showPopup() QRect popupRect(m_locationBar->mapToGlobal(m_locationBar->pos()), m_locationBar->size()); popupRect.setY(popupRect.bottom()); + if (qzSettings->completionPopupExpandToWindow) { + popupRect.setX(m_window->mapToGlobal(QPoint(0,0)).x()); + popupRect.setWidth(m_window->size().width()); + } + s_view->setGeometry(popupRect); s_view->setFocusProxy(m_locationBar); s_view->setCurrentIndex(QModelIndex()); diff --git a/src/lib/other/qzsettings.cpp b/src/lib/other/qzsettings.cpp index 8d4f1cd29..6441d13a1 100644 --- a/src/lib/other/qzsettings.cpp +++ b/src/lib/other/qzsettings.cpp @@ -35,6 +35,7 @@ void QzSettings::loadSettings() alwaysShowGoIcon = settings.value("alwaysShowGoIcon", false).toBool(); useInlineCompletion = settings.value("useInlineCompletion", true).toBool(); showZoomLabel = settings.value("showZoomLabel", true).toBool(); + completionPopupExpandToWindow = settings.value("CompletionPopupExpandToWindow", false).toBool(); settings.endGroup(); settings.beginGroup("SearchEngines"); diff --git a/src/lib/other/qzsettings.h b/src/lib/other/qzsettings.h index b76e6c262..f517182c4 100644 --- a/src/lib/other/qzsettings.h +++ b/src/lib/other/qzsettings.h @@ -40,6 +40,7 @@ public: bool alwaysShowGoIcon; bool useInlineCompletion; bool showZoomLabel; + bool completionPopupExpandToWindow; // SearchEngines bool searchOnEngineChange; diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 4b2360e0c..f41d25f73 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -252,6 +252,7 @@ Preferences::Preferences(BrowserWindow* window) ui->showZoomLabel->setChecked(settings.value("showZoomLabel", true).toBool()); ui->selectAllOnFocus->setChecked(settings.value("SelectAllTextOnDoubleClick", true).toBool()); ui->selectAllOnClick->setChecked(settings.value("SelectAllTextOnClick", false).toBool()); + ui->completionPopupExpandToWindow->setChecked(settings.value("CompletionPopupExpandToWindow", false).toBool()); bool showPBinAB = settings.value("ShowLoadingProgress", false).toBool(); ui->showLoadingInAddressBar->setChecked(showPBinAB); ui->adressProgressSettings->setEnabled(showPBinAB); @@ -1032,6 +1033,7 @@ void Preferences::saveSettings() settings.setValue("showSwitchTab", ui->completionShowSwitchTab->isChecked()); settings.setValue("SelectAllTextOnDoubleClick", ui->selectAllOnFocus->isChecked()); settings.setValue("SelectAllTextOnClick", ui->selectAllOnClick->isChecked()); + settings.setValue("CompletionPopupExpandToWindow", ui->completionPopupExpandToWindow->isChecked()); settings.setValue("ShowLoadingProgress", ui->showLoadingInAddressBar->isChecked()); settings.setValue("ProgressStyle", ui->progressStyleSelector->currentIndex()); settings.setValue("UseCustomProgressColor", ui->checkBoxCustomProgressColor->isChecked()); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index ea8babe96..4e326c88a 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -860,6 +860,13 @@ + + + + Expand suggestion popup to window width + + +