From cf5ba0378ad03168d436340dc3de79f850349d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 27 Aug 2013 11:57:21 +0200 Subject: [PATCH] setRoleNames is deprecated Instead implementing roleNames(). --- kcmkwin/kwincompositing/model.cpp | 8 ++++++-- kcmkwin/kwincompositing/model.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kcmkwin/kwincompositing/model.cpp b/kcmkwin/kwincompositing/model.cpp index eb987178c3..6e6f9fc337 100644 --- a/kcmkwin/kwincompositing/model.cpp +++ b/kcmkwin/kwincompositing/model.cpp @@ -47,6 +47,11 @@ namespace Compositing { EffectModel::EffectModel(QObject *parent) : QAbstractItemModel(parent) { + loadEffects(); +} + +QHash< int, QByteArray > EffectModel::roleNames() const +{ QHash roleNames; roleNames[NameRole] = "NameRole"; roleNames[DescriptionRole] = "DescriptionRole"; @@ -57,8 +62,7 @@ EffectModel::EffectModel(QObject *parent) roleNames[CategoryRole] = "CategoryRole"; roleNames[ServiceNameRole] = "ServiceNameRole"; roleNames[EffectStatusRole] = "EffectStatusRole"; - setRoleNames(roleNames); - loadEffects(); + return roleNames; } QModelIndex EffectModel::index(int row, int column, const QModelIndex &parent) const { diff --git a/kcmkwin/kwincompositing/model.h b/kcmkwin/kwincompositing/model.h index 7bb6768dd2..8bba11d589 100644 --- a/kcmkwin/kwincompositing/model.h +++ b/kcmkwin/kwincompositing/model.h @@ -72,6 +72,8 @@ public: QString serviceName(const QString &effectName); bool effectListContains(const QString &effectFilter, int source_row); + virtual QHash< int, QByteArray > roleNames() const override; + Q_INVOKABLE void effectStatus(const QModelIndex &index, bool effectState); Q_INVOKABLE QString findImage(const QString &imagePath, int size = 128); Q_INVOKABLE void reload();