Commit 35d48002 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

Pass Qt::MatchExactly when calling QAbstractItemModel::match for strings

It defaults to Qt::MatchStartsWith and thus returns the wrong result.
parent bf06a8a2
......@@ -237,7 +237,7 @@ void KCMColors::installSchemeFile(const QString &path)
m_model->load();
const auto results = m_model->match(m_model->index(0, 0), ColorsModel::SchemeNameRole, newName);
const auto results = m_model->match(m_model->index(0, 0), ColorsModel::SchemeNameRole, newName, 1, Qt::MatchExactly);
if (!results.isEmpty()) {
m_model->setSelectedScheme(newName);
}
......
......@@ -49,7 +49,7 @@ void FilterProxyModel::setSelectedScheme(const QString &scheme)
int FilterProxyModel::selectedSchemeIndex() const
{
// We must search in the source model and then map the index to our proxy model.
const auto results = sourceModel()->match(sourceModel()->index(0, 0), ColorsModel::SchemeNameRole, m_selectedScheme);
const auto results = sourceModel()->match(sourceModel()->index(0, 0), ColorsModel::SchemeNameRole, m_selectedScheme, 1, Qt::MatchExactly);
if (results.count() == 1) {
const QModelIndex result = mapFromSource(results.first());
......
......@@ -53,7 +53,7 @@ void FilterProxyModel::setSelectedTheme(const QString &pluginName)
int FilterProxyModel::selectedThemeIndex() const
{
// We must search in the source model and then map the index to our proxy model.
const auto results = sourceModel()->match(sourceModel()->index(0, 0), ThemesModel::PluginNameRole, m_selectedTheme);
const auto results = sourceModel()->match(sourceModel()->index(0, 0), ThemesModel::PluginNameRole, m_selectedTheme, 1, Qt::MatchExactly);
if (results.count() == 1) {
const QModelIndex result = mapFromSource(results.first());
......
......@@ -140,7 +140,7 @@ void ThemesModel::setSelectedTheme(const QString &pluginName)
int ThemesModel::pluginIndex(const QString &pluginName) const
{
const auto results = match(index(0, 0), PluginNameRole, pluginName);
const auto results = match(index(0, 0), PluginNameRole, pluginName, 1, Qt::MatchExactly);
if (results.count() == 1) {
return results.first().row();
}
......
......@@ -491,7 +491,7 @@ QPixmap IconModule::getBestIcon(KIconTheme &theme, const QStringList &iconNames,
int IconModule::pluginIndex(const QString &themeName) const
{
const auto results = m_model->match(m_model->index(0, 0), ThemeNameRole, themeName);
const auto results = m_model->match(m_model->index(0, 0), ThemeNameRole, themeName, 1, Qt::MatchExactly);
if (results.count() == 1) {
return results.first().row();
}
......
......@@ -125,7 +125,7 @@ QStandardItemModel *KCMLookandFeel::lookAndFeelModel() const
int KCMLookandFeel::pluginIndex(const QString &pluginName) const
{
const auto results = m_model->match(m_model->index(0, 0), PluginNameRole, pluginName);
const auto results = m_model->match(m_model->index(0, 0), PluginNameRole, pluginName, 1, Qt::MatchExactly);
if (results.count() == 1) {
return results.first().row();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment