UI: Options: Fix "Theme" selected value

This commit is contained in:
Nodir Temirkhodjaev 2024-08-17 16:55:59 +05:00
parent 8a1b710ea0
commit 80929e6d4a
2 changed files with 4 additions and 5 deletions

View File

@ -142,9 +142,10 @@ void IfacePage::retranslateComboTheme()
// Sync with Qt::ColorScheme // Sync with Qt::ColorScheme
const QStringList list = { tr("System"), tr("Light"), tr("Dark") }; 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() void IfacePage::retranslateComboHotKey()
@ -336,9 +337,6 @@ QLayout *IfacePage::setupThemeLayout()
}); });
m_comboTheme->setFixedWidth(200); m_comboTheme->setFixedWidth(200);
const auto colorScheme = IniUser::colorSchemeByName(iniUser()->theme());
m_comboTheme->setCurrentIndex(colorScheme);
#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 8, 0)
m_comboTheme->setEnabled(false); m_comboTheme->setEnabled(false);
#endif #endif

View File

@ -74,6 +74,7 @@ private:
QComboBox *m_comboLanguage = nullptr; QComboBox *m_comboLanguage = nullptr;
QLabel *m_labelTheme = nullptr; QLabel *m_labelTheme = nullptr;
QComboBox *m_comboTheme = nullptr; QComboBox *m_comboTheme = nullptr;
QCheckBox *m_cbHotKeysEnabled = nullptr; QCheckBox *m_cbHotKeysEnabled = nullptr;
QCheckBox *m_cbHotKeysGlobal = nullptr; QCheckBox *m_cbHotKeysGlobal = nullptr;
QLabel *m_labelHotKey = nullptr; QLabel *m_labelHotKey = nullptr;