on bd49d29 help sign in
unity8/tests/mocks/Unity/Notifications/MockActionModel.h
51 lines 1.5 kB history raw
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Mirco Mueller <mirco.mueller@canonical.com>
18 */
20#ifndef MOCK_ACTION_MODEL_H
21#define MOCK_ACTION_MODEL_H
23#include <QStringListModel>
25struct ActionModelPrivate;
27class ActionModel : public QStringListModel {
28 Q_OBJECT
30public:
31 ActionModel(QObject *parent=nullptr);
32 virtual ~ActionModel();
34 virtual int rowCount(const QModelIndex &index) const;
35 virtual QVariant data(const QModelIndex &index, int role) const;
36 virtual QHash<int, QByteArray> roleNames() const;
38 Q_ENUMS(ActionsRoles)
39 enum ActionsRoles {
40 RoleActionLabel = Qt::UserRole + 1,
41 RoleActionId = Qt::UserRole + 2
42 };
43 Q_INVOKABLE QVariant data(int row, int role) const;
45 void insertAction(const QString &id, const QString &label);
47private:
48 QScopedPointer<ActionModelPrivate> p;
49};
51#endif // MOCK_ACTION_MODEL_H