From b2e099a56b3d5e7ed4115c4026b60b27ab78b1dc Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Thu, 31 Dec 2020 20:25:06 +1100 Subject: urlbar styling: only remove styles if not already removed --- src/browsertab.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/browsertab.cpp b/src/browsertab.cpp index f98a0f2..18ec5cc 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -1136,6 +1136,7 @@ void BrowserTab::updateUrlBarStyle() // Set all text to default colour if url bar // is focused, is at an internal location (like about:...), // or has an invalid URL. + static bool no_style = false; if (!kristall::options.fancy_urlbar || this->ui->url_bar->hasFocus() || !url.isValid() || @@ -1143,11 +1144,17 @@ void BrowserTab::updateUrlBarStyle() mainWindow->settings_visible) { // Disable styling - setLineEditTextFormat(this->ui->url_bar, - QList()); + if (!no_style) + { + setLineEditTextFormat(this->ui->url_bar, + QList()); + no_style = true; + } return; } + no_style = false; + // Styling enabled: 'authority' (hostname, port, etc) of // the URL is highlighted (i.e default colour), // the rest is in grey-ish colour @@ -1170,7 +1177,6 @@ void BrowserTab::updateUrlBarStyle() QTextCharFormat f; f.setForeground(mainWindow->palette().color(QPalette::PlaceholderText)); - // Create format range for left-side of URL QTextLayout::FormatRange fr_left; fr_left.start = 0; -- cgit v1.2.3