1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef KCOLORSCHEMEMODEL_H |
9 | #define KCOLORSCHEMEMODEL_H |
10 | |
11 | #include "kcolorscheme_export.h" |
12 | |
13 | #include <QAbstractListModel> |
14 | #include <QObject> |
15 | #include <memory> |
16 | |
17 | class QModelIndex; |
18 | |
19 | struct KColorSchemeModelPrivate; |
20 | |
21 | /*! |
22 | * \class KColorSchemeModel |
23 | * \inmodule KColorScheme |
24 | * |
25 | * \brief A model listing the KColorSchemes available in the system. |
26 | * |
27 | * \since 5.84 |
28 | */ |
29 | class KColorSchemeModel : public QAbstractListModel |
30 | { |
31 | Q_OBJECT |
32 | public: |
33 | /*! |
34 | * \value NameRole |
35 | * \value IconRole |
36 | * \value PathRole |
37 | * \value IdRole |
38 | */ |
39 | enum Roles { |
40 | NameRole = Qt::DisplayRole, |
41 | IconRole = Qt::DecorationRole, |
42 | PathRole = Qt::UserRole, |
43 | IdRole, |
44 | }; |
45 | |
46 | explicit KColorSchemeModel(QObject *parent = nullptr); |
47 | ~KColorSchemeModel() override; |
48 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
49 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
50 | |
51 | private: |
52 | std::unique_ptr<KColorSchemeModelPrivate> d; |
53 | }; |
54 | |
55 | #endif |
56 | |