From 700467f6564283fd82870e2c901b9c0444fa3030 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 1 Mar 2026 14:19:34 +1000 Subject: [PATCH] Qt: Disable 'Disable Style Sheets' button when unavailable --- src/duckstation-qt/interfacesettingswidget.cpp | 18 +++++++++++++----- src/duckstation-qt/interfacesettingswidget.h | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/duckstation-qt/interfacesettingswidget.cpp b/src/duckstation-qt/interfacesettingswidget.cpp index 3ab2c4b0f..7a5b1c034 100644 --- a/src/duckstation-qt/interfacesettingswidget.cpp +++ b/src/duckstation-qt/interfacesettingswidget.cpp @@ -111,13 +111,16 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget "this option may cause some UI elements to not fit within windows.")); #endif - QCheckBox* const disable_stylesheet = new QCheckBox(tr("Disable Style Sheets"), m_ui.appearanceGroup); - SettingWidgetBinder::BindWidgetToBoolSetting(sif, disable_stylesheet, "Main", "DisableStylesheet", false); - connect(disable_stylesheet, &QCheckBox::checkStateChanged, this, &QtHost::UpdateApplicationTheme); - m_ui.appearanceLayout->addWidget(disable_stylesheet, next_appearance_row, next_appearance_col++ * 2, 1, 2); - dialog->registerWidgetHelp(disable_stylesheet, tr("Disable Style Sheets"), tr("Unchecked"), + m_disable_style_sheets = new QCheckBox(tr("Disable Style Sheets"), m_ui.appearanceGroup); + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_disable_style_sheets, "Main", "DisableStylesheet", false); + connect(m_disable_style_sheets, &QCheckBox::checkStateChanged, this, &QtHost::UpdateApplicationTheme); + m_ui.appearanceLayout->addWidget(m_disable_style_sheets, next_appearance_row, next_appearance_col++ * 2, 1, 2); + dialog->registerWidgetHelp(m_disable_style_sheets, tr("Disable Style Sheets"), tr("Unchecked"), tr("Disables the use of style sheets in the application, reverting to the original " "'Fusion' style but retaining the color scheme.")); + connect(m_ui.theme, &QComboBox::currentIndexChanged, this, + &InterfaceSettingsWidget::updateDisableStyleSheetsEnabled); + updateDisableStyleSheetsEnabled(); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoUpdateEnabled, "AutoUpdater", "CheckAtStartup", true); for (const auto& [name, desc] : AutoUpdaterDialog::getChannelList()) @@ -288,6 +291,11 @@ void InterfaceSettingsWidget::onLanguageChanged() g_main_window->recreate(); } +void InterfaceSettingsWidget::updateDisableStyleSheetsEnabled() +{ + m_disable_style_sheets->setEnabled(QtHost::IsStylesheetTheme(m_ui.theme->currentData().toString().toStdString())); +} + void InterfaceSettingsWidget::checkForUpdates() { // this will return null if there's already a check in progress diff --git a/src/duckstation-qt/interfacesettingswidget.h b/src/duckstation-qt/interfacesettingswidget.h index 090e5804a..7406e56ad 100644 --- a/src/duckstation-qt/interfacesettingswidget.h +++ b/src/duckstation-qt/interfacesettingswidget.h @@ -23,9 +23,11 @@ public: private: void updateRenderToSeparateWindowOptions(); void onLanguageChanged(); + void updateDisableStyleSheetsEnabled(); void checkForUpdates(); Ui::InterfaceSettingsWidget m_ui; SettingsWindow* m_dialog; + QCheckBox* m_disable_style_sheets = nullptr; };