diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index 7f210a48b..78bec8b75 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -54,12 +54,14 @@ DevicesModel::DevicesModel(QObject *parent) this, SLOT(deviceRemoved(QString))); refreshDeviceList(); +} - //Role names for QML - QHash names = roleNames(); +QHash< int, QByteArray > DevicesModel::roleNames() const +{ + QHash names = QAbstractItemModel::roleNames(); names.insert(IdModelRole, "deviceId"); names.insert(IconNameRole, "iconName"); - setRoleNames(names); + return names; } DevicesModel::~DevicesModel() diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h index 75ee0c12b..b2cda7216 100644 --- a/interfaces/devicesmodel.h +++ b/interfaces/devicesmodel.h @@ -65,6 +65,7 @@ public: virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; DeviceDbusInterface* getDevice(const QModelIndex& index) const; + virtual QHash roleNames() const; public Q_SLOTS: void deviceStatusChanged(const QString& id); diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp index 0aad0b84e..0f4c197b6 100644 --- a/interfaces/notificationsmodel.cpp +++ b/interfaces/notificationsmodel.cpp @@ -44,14 +44,15 @@ NotificationsModel::NotificationsModel(QObject* parent) connect(this, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SIGNAL(anyDismissableChanged())); +} - //Role names for QML - QHash names = roleNames(); +QHash NotificationsModel::roleNames() const +{ + QHash names = QAbstractItemModel::roleNames(); names.insert(DbusInterfaceRole, "dbusInterface"); names.insert(AppNameModelRole, "appName"); names.insert(DismissableModelRole, "dismissable"); - setRoleNames(names); - + return names; } NotificationsModel::~NotificationsModel() diff --git a/interfaces/notificationsmodel.h b/interfaces/notificationsmodel.h index f9a747973..3066093bd 100644 --- a/interfaces/notificationsmodel.h +++ b/interfaces/notificationsmodel.h @@ -59,6 +59,7 @@ public: NotificationDbusInterface* getNotification(const QModelIndex& index) const; Q_INVOKABLE bool isAnyDimissable() const; + virtual QHash roleNames() const; public Q_SLOTS: void dismissAll();