Changeset View
Changeset View
Standalone View
Standalone View
kcms/cursortheme/xcursor/sortproxymodel.h
Show All 28 Lines | |||||
29 | * | 29 | * | ||
30 | * First it compares the Qt::DisplayRoles, and if they match it compares | 30 | * First it compares the Qt::DisplayRoles, and if they match it compares | ||
31 | * the CursorTheme::DisplayDetailRoles. | 31 | * the CursorTheme::DisplayDetailRoles. | ||
32 | * | 32 | * | ||
33 | * The model assumes both display roles are QStrings. | 33 | * The model assumes both display roles are QStrings. | ||
34 | */ | 34 | */ | ||
35 | class SortProxyModel : public QSortFilterProxyModel | 35 | class SortProxyModel : public QSortFilterProxyModel | ||
36 | { | 36 | { | ||
37 | Q_OBJECT | ||||
37 | public: | 38 | public: | ||
38 | SortProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {} | 39 | SortProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {} | ||
39 | ~SortProxyModel() {} | 40 | ~SortProxyModel() {} | ||
41 | QHash<int, QByteArray> roleNames() const; | ||||
40 | inline const CursorTheme *theme(const QModelIndex &index) const; | 42 | inline const CursorTheme *theme(const QModelIndex &index) const; | ||
41 | inline QModelIndex findIndex(const QString &name) const; | 43 | inline QModelIndex findIndex(const QString &name) const; | ||
42 | inline QModelIndex defaultIndex() const; | 44 | inline QModelIndex defaultIndex() const; | ||
43 | inline void removeTheme(const QModelIndex &index); | 45 | inline void removeTheme(const QModelIndex &index); | ||
44 | 46 | | |||
45 | private: | 47 | private: | ||
46 | int compare(const QModelIndex &left, const QModelIndex &right, int role) const; | 48 | int compare(const QModelIndex &left, const QModelIndex &right, int role) const; | ||
47 | 49 | | |||
48 | protected: | 50 | protected: | ||
49 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; | 51 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const; | ||
50 | }; | 52 | }; | ||
51 | 53 | | |||
52 | 54 | | |||
53 | const CursorTheme *SortProxyModel::theme(const QModelIndex &index) const | 55 | const CursorTheme *SortProxyModel::theme(const QModelIndex &index) const | ||
54 | { | 56 | { | ||
55 | CursorThemeModel *model = static_cast<CursorThemeModel*>(sourceModel()); | 57 | CursorThemeModel *model = static_cast<CursorThemeModel*>(sourceModel()); | ||
56 | return model->theme(mapToSource(index)); | 58 | return model->theme(mapToSource(index)); | ||
57 | } | 59 | } | ||
Show All 20 Lines |