This commit is contained in:
Martin Rotter 2024-05-22 08:54:21 +02:00
parent 346daa0d89
commit 24f74394e1
2 changed files with 6 additions and 4 deletions

View File

@ -220,7 +220,9 @@ void SettingsGui::loadSettings() {
m_ui->m_cmbStyles->addItem(style_name, style_name); m_ui->m_cmbStyles->addItem(style_name, style_name);
} }
int item_style = m_ui->m_cmbStyles->findData(qApp->skins()->currentStyle()); int item_style = m_ui->m_cmbStyles->findData(qApp->skins()->currentStyle(),
Qt::ItemDataRole::UserRole,
Qt::MatchFlag::MatchFixedString);
if (item_style >= 0) { if (item_style >= 0) {
m_ui->m_cmbStyles->setCurrentIndex(item_style); m_ui->m_cmbStyles->setCurrentIndex(item_style);

View File

@ -153,6 +153,7 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
for (const QString& skin_forced_style : skin.m_forcedStyles) { for (const QString& skin_forced_style : skin.m_forcedStyles) {
if (qApp->setStyle(skin_forced_style) != nullptr) { if (qApp->setStyle(skin_forced_style) != nullptr) {
m_currentStyle = skin_forced_style;
break; break;
} }
} }
@ -160,19 +161,18 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
else { else {
qDebugNN << LOGSEC_GUI << "Setting style:" << QUOTE_W_SPACE_DOT(style_name); qDebugNN << LOGSEC_GUI << "Setting style:" << QUOTE_W_SPACE_DOT(style_name);
qApp->setStyle(style_name); qApp->setStyle(style_name);
m_currentStyle = style_name;
} }
} }
else { else {
m_styleIsFrozen = true; m_styleIsFrozen = true;
m_currentStyle = qApp->style()->objectName();
qWarningNN << LOGSEC_GUI << "Respecting forced style(s):\n" qWarningNN << LOGSEC_GUI << "Respecting forced style(s):\n"
<< " QT_STYLE_OVERRIDE: " QUOTE_NO_SPACE(env_forced_style) << "\n" << " QT_STYLE_OVERRIDE: " QUOTE_NO_SPACE(env_forced_style) << "\n"
<< " CLI (-style): " QUOTE_NO_SPACE(cli_forced_style); << " CLI (-style): " QUOTE_NO_SPACE(cli_forced_style);
} }
// NOTE: We can do this because in Qt source code
// they specifically set object name to style name.
m_currentStyle = qApp->style()->objectName();
m_useSkinColors = m_useSkinColors =
skin.m_forcedSkinColors || qApp->settings()->value(GROUP(GUI), SETTING(GUI::ForcedSkinColors)).toBool(); skin.m_forcedSkinColors || qApp->settings()->value(GROUP(GUI), SETTING(GUI::ForcedSkinColors)).toBool();