Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/decorationmodel.h
Show All 26 Lines | |||||
27 | 27 | | |||
28 | namespace Configuration | 28 | namespace Configuration | ||
29 | { | 29 | { | ||
30 | 30 | | |||
31 | class DecorationsModel : public QAbstractListModel | 31 | class DecorationsModel : public QAbstractListModel | ||
32 | { | 32 | { | ||
33 | Q_OBJECT | 33 | Q_OBJECT | ||
34 | public: | 34 | public: | ||
35 | enum DecorationRole { | ||||
36 | PluginNameRole = Qt::UserRole + 1, | ||||
zzag: Can't we start from Qt::UserRole +1? | |||||
vpilo: It came all the way from 2014 somehow.. I'm not nostalgic. Done | |||||
zzag: We don't need `+2`, and `+3`. | |||||
enum DecoratinoRole { PluginNameRole = Qt::UserRole + 1, ThemeNameRole, ConfigurationRole }; zzag: ```lang=cpp
enum DecoratinoRole {
PluginNameRole = Qt::UserRole + 1,
ThemeNameRole… | |||||
37 | ThemeNameRole = Qt::UserRole + 2, | ||||
38 | ConfigurationRole = Qt::UserRole + 3, | ||||
39 | }; | ||||
40 | | ||||
41 | public: | ||||
35 | explicit DecorationsModel(QObject *parent = nullptr); | 42 | explicit DecorationsModel(QObject *parent = nullptr); | ||
36 | virtual ~DecorationsModel(); | 43 | virtual ~DecorationsModel(); | ||
37 | 44 | | |||
38 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | 45 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||
39 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; | 46 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||
40 | QHash< int, QByteArray > roleNames() const override; | 47 | QHash< int, QByteArray > roleNames() const override; | ||
41 | 48 | | |||
42 | QModelIndex findDecoration(const QString &pluginName, const QString &themeName = QString()) const; | 49 | QModelIndex findDecoration(const QString &pluginName, const QString &themeName = QString()) const; | ||
43 | 50 | | |||
44 | QMap<QString, QString> knsProviders() const { | 51 | QStringList knsProviders() const { | ||
45 | return m_knsProvides; | 52 | return m_knsProviders; | ||
46 | } | 53 | } | ||
47 | 54 | | |||
48 | public Q_SLOTS: | 55 | public Q_SLOTS: | ||
49 | void init(); | 56 | void init(); | ||
50 | 57 | | |||
51 | private: | 58 | private: | ||
52 | struct Data { | 59 | struct Data { | ||
53 | QString pluginName; | 60 | QString pluginName; | ||
54 | QString themeName; | 61 | QString themeName; | ||
55 | QString visibleName; | 62 | QString visibleName; | ||
56 | bool configuration = false; | 63 | bool configuration = false; | ||
57 | }; | 64 | }; | ||
58 | std::vector<Data> m_plugins; | 65 | std::vector<Data> m_plugins; | ||
59 | QMap<QString, QString> m_knsProvides; | 66 | QStringList m_knsProviders; | ||
60 | }; | 67 | }; | ||
61 | 68 | | |||
62 | } | 69 | } | ||
63 | } | 70 | } | ||
64 | 71 | | |||
65 | #endif | 72 | #endif |
Can't we start from Qt::UserRole +1?