My Project
QuickListModelInterface.h
1 /*
2  * Copyright 2013 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  * Michael Zanetti <michael.zanetti@canonical.com>
18  */
19 
20 #ifndef UNITY_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H
21 #define UNITY_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H
22 
23 #include <unity/SymbolExport.h>
24 
25 #include <QtCore/QAbstractListModel>
26 
27 namespace unity
28 {
29 namespace shell
30 {
31 namespace launcher
32 {
33 
43 class UNITY_API QuickListModelInterface: public QAbstractListModel
44 {
45  Q_OBJECT
46 
47 protected:
49  explicit QuickListModelInterface(QObject *parent = 0) : QAbstractListModel(parent) {
50  m_roleNames.insert(RoleLabel, "label");
51  m_roleNames.insert(RoleIcon, "icon");
52  m_roleNames.insert(RoleClickable, "clickable");
53  m_roleNames.insert(RoleHasSeparator, "hasSeparator");
54  }
56 public:
62  enum Roles {
63  RoleLabel,
64  RoleIcon,
65  RoleClickable,
66  RoleHasSeparator
67  };
68 
70  virtual ~QuickListModelInterface() {}
72 
74  QHash<int, QByteArray> roleNames() const {
75  return m_roleNames;
76  }
78 
79 protected:
81  QHash<int, QByteArray> m_roleNames;
83 
84 };
85 
86 } // launcher
87 } // shell
88 } // unity
89 
90 #endif // UNITY_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H
Top-level namespace for all things Unity-related.
Definition: Version.h:37
Roles
The Roles supported by the model.
Definition: QuickListModelInterface.h:62
A model containing QuickList actions for an application in the launcher.
Definition: QuickListModelInterface.h:43