fix: use a palette for dialogs (#6098)

This commit is contained in:
nerix
2025-03-20 14:03:46 +01:00
committed by GitHub
parent 9750f81ff0
commit a70acbfda9
6 changed files with 30 additions and 14 deletions
+1
View File
@@ -3,6 +3,7 @@
## Unversioned
- Bugfix: Fixed the channel name input not being focused when opening the select-channel dialog. (#6096)
- Bugfix: Fixed inputs in dialogs not having a border around and padding in them. (#6098)
## 2.5.3-beta.1
+23
View File
@@ -555,6 +555,29 @@ void Theme::parseFrom(const QJsonObject &root, bool isCustomTheme)
this->buttons.copy = getResources().buttons.copyLight;
this->buttons.pin = getResources().buttons.pinDisabledLight;
}
// This assumes that we never update the application palette
auto palette = QApplication::palette();
if (this->isLightTheme())
{
palette.setColor(QPalette::Window, this->window.background);
palette.setColor(QPalette::Base, {0xe9, 0xe9, 0xe9});
palette.setColor(QPalette::AlternateBase, {0xe0, 0xe0, 0xe0});
palette.setColor(QPalette::Button, {0xd9, 0xd9, 0xd9});
palette.setColor(QPalette::Text, this->window.text);
palette.setColor(QPalette::WindowText, this->window.text);
palette.setColor(QPalette::ButtonText, this->window.text);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::ToolTipBase, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::black);
palette.setColor(QPalette::Link, Qt::blue);
palette.setColor(QPalette::LinkVisited, Qt::magenta);
palette.setColor(QPalette::Highlight, {42, 130, 218});
palette.setColor(QPalette::HighlightedText, Qt::white);
palette.setColor(QPalette::PlaceholderText, {0x90, 0x90, 0x90});
}
this->palette = palette;
}
bool Theme::isAutoReloading() const
+3
View File
@@ -7,6 +7,7 @@
#include <pajlada/settings/setting.hpp>
#include <QColor>
#include <QJsonObject>
#include <QPalette>
#include <QPixmap>
#include <QString>
#include <QTimer>
@@ -155,6 +156,8 @@ public:
QPixmap pin;
} buttons;
QPalette palette;
void normalizeColor(QColor &color) const;
void update();
+1 -4
View File
@@ -667,10 +667,7 @@ void EmotePopup::themeChangedEvent()
{
BasePopup::themeChangedEvent();
// NOTE: This currently overrides the QLineEdit's font size.
// If the dialog is open when the theme is changed, things will look a bit off.
// This can be alleviated by us using a single application-wide style sheet for these things.
this->search_->setStyleSheet(this->theme->splits.input.styleSheet);
this->setPalette(getTheme()->palette);
}
void EmotePopup::closeEvent(QCloseEvent *event)
+1 -6
View File
@@ -375,12 +375,7 @@ void SelectChannelDialog::themeChangedEvent()
{
BaseWindow::themeChangedEvent();
auto &ui = this->ui_;
// NOTE: This currently overrides the QLineEdit's font size.
// If the dialog is open when the theme is changed, things will look a bit off.
// This can be alleviated by us using a single application-wide style sheet for these things.
ui.channelName->setStyleSheet(this->theme->splits.input.styleSheet);
this->setPalette(getTheme()->palette);
}
void SelectChannelDialog::scaleChangedEvent(float newScale)
+1 -4
View File
@@ -219,10 +219,7 @@ void SearchPopup::themeChangedEvent()
{
BasePopup::themeChangedEvent();
// NOTE: This currently overrides the QLineEdit's font size.
// If the dialog is open when the theme is changed, things will look a bit off.
// This can be alleviated by us using a single application-wide style sheet for these things.
this->searchInput_->setStyleSheet(this->theme->splits.input.styleSheet);
this->setPalette(getTheme()->palette);
}
void SearchPopup::search()