Quick Switch: Add support for light themes (#1858)

This commit is contained in:
Leon Richardt
2020-08-15 10:17:15 +02:00
committed by GitHub
parent fba049dbfb
commit 6781482485
2 changed files with 27 additions and 0 deletions
@@ -1,6 +1,7 @@
#include "widgets/dialogs/switcher/QuickSwitcherPopup.hpp"
#include "Application.hpp"
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/Notebook.hpp"
@@ -48,6 +49,8 @@ QuickSwitcherPopup::QuickSwitcherPopup(QWidget *parent)
// This places the popup in the middle of the parent widget
this->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter,
this->size(), geom));
this->themeChangedEvent();
}
QuickSwitcherPopup::~QuickSwitcherPopup()
@@ -197,4 +200,27 @@ bool QuickSwitcherPopup::eventFilter(QObject *watched, QEvent *event)
return false;
}
void QuickSwitcherPopup::themeChangedEvent()
{
BasePopup::themeChangedEvent();
const QString textCol = this->theme->window.text.name();
const QString bgCol = this->theme->window.background.name();
const QString selCol =
(this->theme->isLightTheme()
? "#68B1FF" // Copied from Theme::splits.input.styleSheet
: this->theme->tabs.selected.backgrounds.regular.color().name());
const QString listStyle =
QString(
"color: %1; background-color: %2; selection-background-color: %3")
.arg(textCol)
.arg(bgCol)
.arg(selCol);
this->ui_.searchEdit->setStyleSheet(this->theme->splits.input.styleSheet);
this->ui_.list->setStyleSheet(listStyle);
}
} // namespace chatterino
@@ -26,6 +26,7 @@ public:
protected:
virtual bool eventFilter(QObject *watched, QEvent *event) override;
virtual void themeChangedEvent() override;
public slots:
void updateSuggestions(const QString &text);