diff options
Diffstat (limited to 'framework/src/extensionmodel.h')
-rw-r--r-- | framework/src/extensionmodel.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/framework/src/extensionmodel.h b/framework/src/extensionmodel.h new file mode 100644 index 00000000..6e984005 --- /dev/null +++ b/framework/src/extensionmodel.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | Copyright (c) 2018 Christian Mollekopf <mollekopf@kolabsys.com> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU Library General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to the | ||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
17 | 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #pragma once | ||
21 | |||
22 | #include <QSortFilterProxyModel> | ||
23 | #include <QSharedPointer> | ||
24 | |||
25 | namespace Kube { | ||
26 | |||
27 | class ExtensionModel : public QSortFilterProxyModel | ||
28 | { | ||
29 | Q_OBJECT | ||
30 | public: | ||
31 | |||
32 | ExtensionModel(QObject *parent = Q_NULLPTR); | ||
33 | ~ExtensionModel() = default; | ||
34 | |||
35 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | ||
36 | |||
37 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; | ||
38 | |||
39 | enum Roles { | ||
40 | Name = Qt::UserRole + 1, | ||
41 | Tooltip, | ||
42 | Icon, | ||
43 | Source | ||
44 | }; | ||
45 | |||
46 | QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; | ||
47 | |||
48 | private slots: | ||
49 | void load(); | ||
50 | }; | ||
51 | |||
52 | } | ||