Changeset View
Changeset View
Standalone View
Standalone View
kcms/keyboard/layoutmodel/layout_list_model_xkb.h
- This file was added.
1 | #ifndef LAYOUTLISTMODEL_H | ||||
---|---|---|---|---|---|
2 | #define LAYOUTLISTMODEL_H | ||||
3 | | ||||
4 | #include <QAbstractItemModel> | ||||
5 | | ||||
6 | #include "layout_list_model_base.h" | ||||
7 | #include "../xkb_rules.h" | ||||
8 | | ||||
9 | class LayoutListModelXkb : public QAbstractItemModel, public LayoutListModelBase { | ||||
10 | Q_OBJECT | ||||
11 | | ||||
12 | public: | ||||
13 | explicit LayoutListModelXkb(QObject* parent = nullptr); | ||||
14 | | ||||
15 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; | ||||
16 | | ||||
17 | int columnCount(const QModelIndex& parent = QModelIndex()) const override; | ||||
18 | | ||||
19 | Qt::ItemFlags flags(const QModelIndex& index) const override; | ||||
20 | | ||||
21 | QModelIndex index(int row, int column, | ||||
22 | const QModelIndex& parent = QModelIndex()) const override; | ||||
23 | | ||||
24 | QModelIndex parent(const QModelIndex& index) const override; | ||||
25 | | ||||
26 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; | ||||
27 | | ||||
28 | private: | ||||
29 | struct Item { | ||||
30 | virtual ~Item() = default; | ||||
31 | }; | ||||
32 | | ||||
33 | struct Layout; | ||||
34 | struct LayoutVariant : Item { | ||||
35 | QString id; | ||||
36 | QString description; | ||||
37 | QVariantList languages; | ||||
38 | int parent_index; | ||||
39 | }; | ||||
40 | | ||||
41 | struct Layout : Item { | ||||
42 | QString id; | ||||
43 | QString description; | ||||
44 | QVariantList languages; | ||||
45 | QList<LayoutVariant> variants; | ||||
46 | }; | ||||
47 | | ||||
48 | using LayoutList = QList<Layout>; | ||||
49 | | ||||
50 | QScopedPointer<LayoutList> m_layouts; | ||||
51 | }; | ||||
52 | | ||||
53 | #endif // LAYOUTLISTMODEL_H |