My Project
Loading...
Searching...
No Matches
SettingsModelInterface.h
1/*
2 * Copyright (C) 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 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_SETTINGSMODELINTERFACE_H
18#define UNITY_SHELL_SCOPES_SETTINGSMODELINTERFACE_H
19
20#include <unity/SymbolExport.h>
21
22#include <QAbstractListModel>
23
24namespace unity
25{
26namespace shell
27{
28namespace scopes
29{
30
31class UNITY_API SettingsModelInterface: public QAbstractListModel
32{
33Q_OBJECT
34
38Q_PROPERTY(int count READ count NOTIFY countChanged)
39
40protected:
42 explicit SettingsModelInterface(QObject* parent = 0)
43 : QAbstractListModel(parent)
44 {
45 }
47
48public:
49 virtual ~SettingsModelInterface() = default;
50
51 virtual int count() const = 0;
52
56 enum Roles
57 {
58 RoleSettingId,
59 RoleDisplayName,
60 RoleType,
61 RoleProperties,
62 RoleValue
63 };
64 Q_ENUM(Roles)
65
66 // @cond
67 QHash<int, QByteArray> roleNames() const override
68 {
69 QHash<int, QByteArray> roles;
70 roles[RoleSettingId] = "settingId";
71 roles[RoleDisplayName] = "displayName";
72 roles[RoleType] = "type";
73 roles[RoleProperties] = "properties";
74 roles[RoleValue] = "value";
75 return roles;
76 }
77 // @endcond
78
79Q_SIGNALS:
80 // @cond
81 void countChanged();
82 // @endcond
83};
84
85}
86}
87}
88
90
91#endif /* UNITY_SHELL_SCOPES_SETTINGSMODELINTERFACE_H */
Definition SettingsModelInterface.h:32
Roles
The roles supported by this model.
Definition SettingsModelInterface.h:57
Top-level namespace for all things Unity-related.
Definition Version.h:38