From 77a7acd5291068c692aa5733b5431603dbc5b2f1 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 11 May 2025 14:28:14 -0400 Subject: [PATCH] Fix disabled arrow styling on Default theme --- resources/themes.qrc | 1 + resources/themes/default.qss | 25 +++++++++++++++++++++++++ src/mainwindow.cpp | 12 ++++-------- src/ui/preferenceeditor.cpp | 4 +++- 4 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 resources/themes/default.qss diff --git a/resources/themes.qrc b/resources/themes.qrc index 5707a161..f9825b50 100644 --- a/resources/themes.qrc +++ b/resources/themes.qrc @@ -1,6 +1,7 @@ themes/dark.qss + themes/default.qss themes/midnight.qss diff --git a/resources/themes/default.qss b/resources/themes/default.qss new file mode 100644 index 00000000..89f02c88 --- /dev/null +++ b/resources/themes/default.qss @@ -0,0 +1,25 @@ +/* DEFAULT theme for porymap */ + +/* + For newer versions of macOS at least, icons + using Qt::ArrowType do not change color when + disabled, so we specify the color change ourselves. +*/ +QToolButton { + color: black; +} +QToolButton:disabled { + color: gray; +} +QComboBox { + color: black; +} +QComboBox:disabled { + color: gray; +} +QAbstractSpinBox { + color: black; +} +QAbstractSpinBox:disabled { + color: gray; +} diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7d1f177a..0474e7ff 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -669,14 +669,10 @@ void MainWindow::restoreWindowState() { } void MainWindow::setTheme(QString theme) { - if (theme == "default") { - setStyleSheet(""); - } else { - QFile File(QString(":/themes/%1.qss").arg(theme)); - File.open(QFile::ReadOnly); - QString stylesheet = QLatin1String(File.readAll()); - setStyleSheet(stylesheet); - } + QFile File(QString(":/themes/%1.qss").arg(theme)); + File.open(QFile::ReadOnly); + QString stylesheet = QLatin1String(File.readAll()); + setStyleSheet(stylesheet); } bool MainWindow::openProject(QString dir, bool initial) { diff --git a/src/ui/preferenceeditor.cpp b/src/ui/preferenceeditor.cpp index 291c14ab..aa5ad513 100644 --- a/src/ui/preferenceeditor.cpp +++ b/src/ui/preferenceeditor.cpp @@ -38,7 +38,9 @@ void PreferenceEditor::initFields() { QDirIterator it(":/themes", QDirIterator::Subdirectories); while (it.hasNext()) { QString themeName = re.match(it.next()).captured(1); - themes.append(themeName); + if (!themes.contains(themeName)) { + themes.append(themeName); + } } themeSelector->addItems(themes); }