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(); QStringList styleNames = QStyleFactory::keys();
std::sort(styleNames.begin(), styleNames.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>()); std::sort(styleNames.begin(), styleNames.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
m_ui->comboStyle->addItems(styleNames); m_ui->comboStyle->addItems(styleNames);
const QString prefStyleName = Preferences::instance()->getStyle(); const QString prefStyleName = Preferences::instance()->getStyle();
const QString selectedStyleName = prefStyleName.isEmpty() ? QApplication::style()->name() : prefStyleName; const QString selectedStyleName = prefStyleName.isEmpty() ? QApplication::style()->name() : prefStyleName;
m_ui->comboStyle->setCurrentIndex(m_ui->comboStyle->findText(selectedStyleName, Qt::MatchFixedString));
if (selectedStyleName.compare(u"system"_s, Qt::CaseInsensitive) != 0)
m_ui->comboStyle->setCurrentText(selectedStyleName);
#else #else
m_ui->labelStyle->hide(); m_ui->labelStyle->hide();
m_ui->comboStyle->hide(); m_ui->comboStyle->hide();