21 #ifndef INDICATORSMODEL_H 22 #define INDICATORSMODEL_H 24 #include "indicator.h" 25 #include "unityindicatorsglobal.h" 27 #include <QAbstractListModel> 30 class IndicatorsManager;
32 class UNITYINDICATORS_EXPORT IndicatorsModel :
public QAbstractListModel
35 Q_PROPERTY(
int count READ count NOTIFY countChanged)
36 Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
40 IndicatorsModel(QObject *parent=
nullptr);
43 Q_INVOKABLE
void load();
44 Q_INVOKABLE
void unload();
46 Q_INVOKABLE QVariant data(
int row,
int role)
const;
48 QString profile()
const;
49 void setProfile(
const QString& profile);
52 QHash<int, QByteArray> roleNames()
const override;
53 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
54 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
55 QModelIndex parent (
const QModelIndex &index)
const override;
56 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
61 void profileChanged();
62 void indicatorDataChanged(
const QVariant& data);
65 void onIdentifierChanged();
66 void onIndicatorPropertiesChanged();
67 void onIndicatorLoaded(
const QString& indicator);
68 void onIndicatorAboutToBeUnloaded(
const QString& indicator);
71 IndicatorsManager *m_manager;
73 QList<Indicator::Ptr> m_indicators;
75 void notifyDataChanged(QObject *sender,
int role);
79 #endif // INDICATORSMODEL_H