setRoleNames is deprecated

Instead implementing roleNames().
This commit is contained in:
Martin Gräßlin 2013-08-27 11:57:21 +02:00
parent c32758c458
commit cf5ba0378a
2 changed files with 8 additions and 2 deletions

View file

@ -47,6 +47,11 @@ namespace Compositing {
EffectModel::EffectModel(QObject *parent) EffectModel::EffectModel(QObject *parent)
: QAbstractItemModel(parent) { : QAbstractItemModel(parent) {
loadEffects();
}
QHash< int, QByteArray > EffectModel::roleNames() const
{
QHash<int, QByteArray> roleNames; QHash<int, QByteArray> roleNames;
roleNames[NameRole] = "NameRole"; roleNames[NameRole] = "NameRole";
roleNames[DescriptionRole] = "DescriptionRole"; roleNames[DescriptionRole] = "DescriptionRole";
@ -57,8 +62,7 @@ EffectModel::EffectModel(QObject *parent)
roleNames[CategoryRole] = "CategoryRole"; roleNames[CategoryRole] = "CategoryRole";
roleNames[ServiceNameRole] = "ServiceNameRole"; roleNames[ServiceNameRole] = "ServiceNameRole";
roleNames[EffectStatusRole] = "EffectStatusRole"; roleNames[EffectStatusRole] = "EffectStatusRole";
setRoleNames(roleNames); return roleNames;
loadEffects();
} }
QModelIndex EffectModel::index(int row, int column, const QModelIndex &parent) const { QModelIndex EffectModel::index(int row, int column, const QModelIndex &parent) const {

View file

@ -72,6 +72,8 @@ public:
QString serviceName(const QString &effectName); QString serviceName(const QString &effectName);
bool effectListContains(const QString &effectFilter, int source_row); 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 void effectStatus(const QModelIndex &index, bool effectState);
Q_INVOKABLE QString findImage(const QString &imagePath, int size = 128); Q_INVOKABLE QString findImage(const QString &imagePath, int size = 128);
Q_INVOKABLE void reload(); Q_INVOKABLE void reload();