From 80929e6d4a31701f6b209bd8949116ecd18c329f Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sat, 17 Aug 2024 16:55:59 +0500 Subject: [PATCH] UI: Options: Fix "Theme" selected value --- src/ui/form/opt/pages/ifacepage.cpp | 8 +++----- src/ui/form/opt/pages/ifacepage.h | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ui/form/opt/pages/ifacepage.cpp b/src/ui/form/opt/pages/ifacepage.cpp index cfcd064a..01879075 100644 --- a/src/ui/form/opt/pages/ifacepage.cpp +++ b/src/ui/form/opt/pages/ifacepage.cpp @@ -142,9 +142,10 @@ void IfacePage::retranslateComboTheme() // Sync with Qt::ColorScheme const QStringList list = { tr("System"), tr("Light"), tr("Dark") }; - const int currentIndex = qMax(m_comboTheme->currentIndex(), 0); + ControlUtil::setComboBoxTexts(m_comboTheme, list); - ControlUtil::setComboBoxTexts(m_comboTheme, list, currentIndex); + const auto colorScheme = IniUser::colorSchemeByName(iniUser()->theme()); + m_comboTheme->setCurrentIndex(colorScheme); } void IfacePage::retranslateComboHotKey() @@ -336,9 +337,6 @@ QLayout *IfacePage::setupThemeLayout() }); m_comboTheme->setFixedWidth(200); - const auto colorScheme = IniUser::colorSchemeByName(iniUser()->theme()); - m_comboTheme->setCurrentIndex(colorScheme); - #if QT_VERSION < QT_VERSION_CHECK(6, 8, 0) m_comboTheme->setEnabled(false); #endif diff --git a/src/ui/form/opt/pages/ifacepage.h b/src/ui/form/opt/pages/ifacepage.h index 0c569e0f..ddfa9112 100644 --- a/src/ui/form/opt/pages/ifacepage.h +++ b/src/ui/form/opt/pages/ifacepage.h @@ -74,6 +74,7 @@ private: QComboBox *m_comboLanguage = nullptr; QLabel *m_labelTheme = nullptr; QComboBox *m_comboTheme = nullptr; + QCheckBox *m_cbHotKeysEnabled = nullptr; QCheckBox *m_cbHotKeysGlobal = nullptr; QLabel *m_labelHotKey = nullptr;