Fix disabled arrow styling on Default theme

This commit is contained in:
GriffinR 2025-05-11 14:28:14 -04:00
parent 2a7927ae82
commit 77a7acd529
4 changed files with 33 additions and 9 deletions

View File

@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/">
<file>themes/dark.qss</file>
<file>themes/default.qss</file>
<file>themes/midnight.qss</file>
</qresource>
</RCC>

View File

@ -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;
}

View File

@ -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) {

View File

@ -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);
}