Qt/Windows: Just use a fixed dark fusion style.

Fix dark/light icon calculation to not be based on actual colors,
not the OS theme.
This commit is contained in:
BearOso 2024-04-16 14:47:57 -05:00
parent 31db46516d
commit e0849ab384
3 changed files with 30 additions and 8 deletions

View File

@ -611,11 +611,6 @@ QString EmuApplication::iconPrefix()
const char *whiteicons = ":/icons/whiteicons/"; const char *whiteicons = ":/icons/whiteicons/";
const char *blackicons = ":/icons/blackicons/"; const char *blackicons = ":/icons/blackicons/";
if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark)
return whiteicons;
if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Light)
return blackicons;
if (QGuiApplication::palette().color(QPalette::WindowText).lightness() > if (QGuiApplication::palette().color(QPalette::WindowText).lightness() >
QGuiApplication::palette().color(QPalette::Window).lightness()) QGuiApplication::palette().color(QPalette::Window).lightness())
return whiteicons; return whiteicons;

View File

@ -26,7 +26,7 @@ void FoldersPanel::connectEntry(QComboBox *combo, QLineEdit *lineEdit, QPushButt
QObject::connect(combo, &QComboBox::activated, [=](int index) { QObject::connect(combo, &QComboBox::activated, [=](int index) {
*location = index; *location = index;
refreshEntry(combo, lineEdit, browse, location, folder); this->refreshEntry(combo, lineEdit, browse, location, folder);
app->updateSettings(); app->updateSettings();
}); });

View File

@ -28,8 +28,35 @@ int main(int argc, char *argv[])
if (emu.qtapp->platformName() == "windows") if (emu.qtapp->platformName() == "windows")
{ {
if (emu.qtapp->style()->name() == "windows11") emu.qtapp->setStyle("fusion");
emu.qtapp->setStyle("windowsvista");
const QColor darkGray(53, 53, 53);
const QColor gray(128, 128, 128);
const QColor black(25, 25, 25);
const QColor blue(198, 238, 255);
const QColor blue2(0, 88, 208);
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, darkGray);
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, black);
darkPalette.setColor(QPalette::AlternateBase, darkGray);
darkPalette.setColor(QPalette::ToolTipBase, blue2);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Button, darkGray);
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::Link, blue);
darkPalette.setColor(QPalette::Highlight, blue2);
darkPalette.setColor(QPalette::HighlightedText, Qt::white);
darkPalette.setColor(QPalette::PlaceholderText, QColor(Qt::white).darker());
darkPalette.setColor(QPalette::Active, QPalette::Button, darkGray);
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray);
darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray);
darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray);
darkPalette.setColor(QPalette::Disabled, QPalette::Light, darkGray);
emu.qtapp->setPalette(darkPalette);
} }
#ifndef _WIN32 #ifndef _WIN32