1 | |
2 | /* |
3 | * infokcmproxymodel.h |
4 | * |
5 | * Copyright (C) 2010 David Hubner <hubnerd@ntlworld.com> |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | * |
21 | */ |
22 | |
23 | #ifndef INFOKCMPROXYMODEL |
24 | #define INFOKCMPROXYMODEL |
25 | |
26 | //QT |
27 | #include <QModelIndex> |
28 | #include <QObject> |
29 | #include <QSortFilterProxyModel> |
30 | |
31 | //Local |
32 | #include "kcmtreeitem.h" |
33 | |
34 | class InfoKcmProxyModel : public QSortFilterProxyModel |
35 | { |
36 | public: |
37 | |
38 | /** |
39 | * Create InfoKcMProxyModel object. Used to filter out |
40 | * and sort a tree view. |
41 | * |
42 | * @param parent objects parent |
43 | */ |
44 | InfoKcmProxyModel(QObject *parent); |
45 | |
46 | /** |
47 | * Check if left item is less than right item |
48 | * Uses X-KDE-Weight for measurements |
49 | */ |
50 | bool lessThan(const QModelIndex &, const QModelIndex &) const; |
51 | |
52 | private: |
53 | |
54 | /** |
55 | * Filter out rows |
56 | * Used in search implementation |
57 | */ |
58 | bool filterAcceptsRow(int, const QModelIndex &) const; |
59 | }; |
60 | |
61 | #endif // INFOKCMPROXYMODEL |
62 | |