Commit 247d9c38 authored by Ismael Asensio's avatar Ismael Asensio

kcm/kwinrules: Restore method textOfValue()

This convenience invokable method was removed in 66ee8985
by mistake, since it's still used in RulesEditor.qml

While at it, optimize arguments to const &
parent 93194a67
......@@ -59,7 +59,7 @@ int OptionsModel::selectedIndex() const
return m_index;
}
int OptionsModel::indexOf(QVariant value) const
int OptionsModel::indexOf(const QVariant &value) const
{
for (int index = 0; index < m_data.count(); index++) {
if (m_data.at(index).value == value) {
......@@ -69,6 +69,15 @@ int OptionsModel::indexOf(QVariant value) const
return -1;
}
QString OptionsModel::textOfValue(const QVariant &value) const
{
int index = indexOf(value);
if (index < 0 || index >= m_data.count()) {
return QString();
}
return m_data.at(index).text;
}
QVariant OptionsModel::value() const
{
if (m_data.isEmpty()) {
......
......@@ -55,8 +55,8 @@ public:
void updateModelData(const QList<Data> &data);
Q_INVOKABLE int indexOf(QVariant value) const;
Q_INVOKABLE int indexOf(const QVariant &value) const;
Q_INVOKABLE QString textOfValue(const QVariant &value) const;
int selectedIndex() const;
signals:
......
Markdown is supported
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