Handle Qt style names in a case insensitive way

PR #21720.
Closes #21716.
This commit is contained in:
Vladimir Golovnev 2024-11-03 09:54:57 +03:00 committed by GitHub
parent 6f642776b6
commit b083029841
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1710,11 +1710,10 @@ void OptionsDialog::initializeStyleCombo()
QStringList styleNames = QStyleFactory::keys();
std::sort(styleNames.begin(), styleNames.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
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();