My Project
Loading...
Searching...
No Matches
OptionSelectorOptionsInterface.h
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef UNITY_SHELL_SCOPES_OPTIONSELECTOROPTIONSINTERFACE_H
18#define UNITY_SHELL_SCOPES_OPTIONSELECTOROPTIONSINTERFACE_H
19
20#include <unity/SymbolExport.h>
21#include <QAbstractListModel>
22
23namespace unity
24{
25namespace shell
26{
27namespace scopes
28{
29
30class UNITY_API OptionSelectorOptionsInterface : public QAbstractListModel
31{
32 Q_OBJECT
33
34public:
35 enum Roles {
36 RoleOptionId = Qt::UserRole + 1,
37 RoleOptionLabel,
38 RoleOptionChecked
39 };
40 Q_ENUM(Roles)
41
42 Q_INVOKABLE virtual void setChecked(int index, bool checked) = 0;
43
44 QHash<int, QByteArray> roleNames() const override
45 {
46 QHash<int, QByteArray> roles;
47 roles[RoleOptionId] = "id";
48 roles[RoleOptionLabel] = "label";
49 roles[RoleOptionChecked] = "checked";
50 return roles;
51 }
52
53protected:
55 explicit OptionSelectorOptionsInterface(QObject* parent = 0) : QAbstractListModel(parent) {}
57};
58
59}
60}
61}
62
64
65#endif
Definition: OptionSelectorOptionsInterface.h:31
Top-level namespace for all things Unity-related.
Definition: Version.h:38