diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-07-06 20:15:04 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-07-06 20:15:04 -0400 |
| commit | f0c5f6f67298f4009bfb0b1804c6c620d42577e1 (patch) | |
| tree | 4f304e8fabd7d85c4c171eb93d68909c26cccfab /src | |
| parent | 9c00d7b7f648fe6a7a84a66714641bd18abf6989 (diff) | |
fixed "not logged in" in the statusbar not respecting theme
Diffstat (limited to 'src')
| -rw-r--r-- | src/statusbar.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/statusbar.cpp b/src/statusbar.cpp index 8ad5bea1..e9a6e658 100644 --- a/src/statusbar.cpp +++ b/src/statusbar.cpp @@ -23,7 +23,7 @@ StatusBar::StatusBar(QStatusBar* bar, Ui::MainWindow* ui) : m_bar->addPermanentWidget(m_notifications); m_bar->addPermanentWidget(m_update); m_bar->addPermanentWidget(m_api); - + m_progress->setTextVisible(true); m_progress->setRange(0, 100); @@ -72,8 +72,8 @@ void StatusBar::setAPI(const APIStats& stats, const APIUserAccount& user) if (user.type() == APIUserAccountTypes::None) { text = "API: not logged in"; - textColor = "initial"; - backgroundColor = "transparent"; + textColor = ""; + backgroundColor = ""; } else { text = QString("API: Queued: %1 | Daily: %2 | Hourly: %3") .arg(stats.requestsQueued) @@ -94,20 +94,25 @@ void StatusBar::setAPI(const APIStats& stats, const APIUserAccount& user) m_api->setText(text); - m_api->setStyleSheet(QString(R"( + QString ss(R"( QLabel { padding-left: 0.1em; padding-right: 0.1em; padding-top: 0; - padding-bottom: 0; - color: %1; - background-color: %2; - } - )") - .arg(textColor) - .arg(backgroundColor)); + padding-bottom: 0;)"); + + if (!textColor.isEmpty()) { + ss += QString("\ncolor: %1;").arg(textColor); + } + + if (!backgroundColor.isEmpty()) { + ss += QString("\nbackground-color: %2;").arg(backgroundColor); + } + + ss += "\n}"; + m_api->setStyleSheet(ss); m_api->setAutoFillBackground(true); } |
