aboutsummaryrefslogtreecommitdiff
path: root/src/browsertab.cpp
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-01-02 12:20:34 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-01-02 12:41:49 +0100
commit05df68b1331dbfdf9aff98139a9a1f96f147e651 (patch)
tree3f84db83e289a37166ef84fe7422f668ef8a92d9 /src/browsertab.cpp
parentb35e6959aef83d9d0873621513d7d7d33d9f141e (diff)
downloadkristall-05df68b1331dbfdf9aff98139a9a1f96f147e651.tar.gz
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
Diffstat (limited to 'src/browsertab.cpp')
-rw-r--r--src/browsertab.cpp14
1 files changed, 6 insertions, 8 deletions
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<QTextLayout::FormatRange>& 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<QTextLayout::FormatRange>());
- 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<QTextLayout::FormatRange> 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;