From 05df68b1331dbfdf9aff98139a9a1f96f147e651 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Sat, 2 Jan 2021 12:20:34 +1100 Subject: Fix bug with fancy url bar styling We are now also using a custom colour for it in the default light/dark themes, just because we can get a little more control over how it looks. The OS Default theme uses the 'mid' colour from palette --- src/browsertab.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/browsertab.cpp') diff --git a/src/browsertab.cpp b/src/browsertab.cpp index 60c3f40..b20d538 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -1115,7 +1115,7 @@ void BrowserTab::setUrlBarText(const QString & text) void BrowserTab::updateUrlBarStyle() { // https://stackoverflow.com/a/14424003 - static const auto setLineEditTextFormat = + const auto setLineEditTextFormat = [](QLineEdit* l, const QList& f) { if (!l) return; @@ -1138,7 +1138,6 @@ 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() || @@ -1146,16 +1145,16 @@ void BrowserTab::updateUrlBarStyle() mainWindow->settings_visible) { // Disable styling - if (!no_style) + if (!this->no_url_style) { setLineEditTextFormat(this->ui->url_bar, QList()); - no_style = true; + this->no_url_style = true; } return; } - no_style = false; + this->no_url_style = false; // Styling enabled: 'authority' (hostname, port, etc) of // the URL is highlighted (i.e default colour), @@ -1173,11 +1172,10 @@ void BrowserTab::updateUrlBarStyle() QList formats; // We only need to create one style, which is the - // non-authority colour text (grey-ish, we use the theme's - // placeholder text colour for this). + // non-authority colour text (grey-ish, determined by theme in kristall:setTheme) // The rest of the text is in default theme foreground colour. QTextCharFormat f; - f.setForeground(mainWindow->palette().color(QPalette::Mid)); + f.setForeground(kristall::options.fancy_urlbar_dim_colour); // Create format range for left-side of URL QTextLayout::FormatRange fr_left; -- cgit v1.2.3