From 374951f6f245533fb757c8af227018da3392a0c6 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sun, 3 Nov 2024 09:54:57 +0300 Subject: [PATCH] Handle Qt style names in a case insensitive way PR #21720. Closes #21716. --- src/gui/optionsdialog.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 60c1c8aef1f..3dc0d113ffd 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -1703,11 +1703,10 @@ void OptionsDialog::initializeStyleCombo() QStringList styleNames = QStyleFactory::keys(); std::sort(styleNames.begin(), styleNames.end(), Utils::Compare::NaturalLessThan()); m_ui->comboStyle->addItems(styleNames); + const QString prefStyleName = Preferences::instance()->getStyle(); const QString selectedStyleName = prefStyleName.isEmpty() ? QApplication::style()->name() : prefStyleName; - - if (selectedStyleName.compare(u"system"_s, Qt::CaseInsensitive) != 0) - m_ui->comboStyle->setCurrentText(selectedStyleName); + m_ui->comboStyle->setCurrentIndex(m_ui->comboStyle->findText(selectedStyleName, Qt::MatchFixedString)); #else m_ui->labelStyle->hide(); m_ui->comboStyle->hide();