author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 08 Apr 2010 14:19:33 +0300 | |
branch | RCL_3 |
changeset 8 | 3f74d0d4af4c |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QSORTFILTERPROXYMODEL_H |
|
43 |
#define QSORTFILTERPROXYMODEL_H |
|
44 |
||
45 |
#include <QtGui/qabstractproxymodel.h> |
|
46 |
||
47 |
#ifndef QT_NO_SORTFILTERPROXYMODEL |
|
48 |
||
49 |
#include <QtCore/qregexp.h> |
|
50 |
||
51 |
QT_BEGIN_HEADER |
|
52 |
||
53 |
QT_BEGIN_NAMESPACE |
|
54 |
||
55 |
QT_MODULE(Gui) |
|
56 |
||
57 |
class QSortFilterProxyModelPrivate; |
|
58 |
class QSortFilterProxyModelLessThan; |
|
59 |
class QSortFilterProxyModelGreaterThan; |
|
60 |
||
61 |
class Q_GUI_EXPORT QSortFilterProxyModel : public QAbstractProxyModel |
|
62 |
{ |
|
63 |
friend class QSortFilterProxyModelLessThan; |
|
64 |
friend class QSortFilterProxyModelGreaterThan; |
|
65 |
||
66 |
Q_OBJECT |
|
67 |
Q_PROPERTY(QRegExp filterRegExp READ filterRegExp WRITE setFilterRegExp) |
|
68 |
Q_PROPERTY(int filterKeyColumn READ filterKeyColumn WRITE setFilterKeyColumn) |
|
69 |
Q_PROPERTY(bool dynamicSortFilter READ dynamicSortFilter WRITE setDynamicSortFilter) |
|
70 |
Q_PROPERTY(Qt::CaseSensitivity filterCaseSensitivity READ filterCaseSensitivity WRITE setFilterCaseSensitivity) |
|
71 |
Q_PROPERTY(Qt::CaseSensitivity sortCaseSensitivity READ sortCaseSensitivity WRITE setSortCaseSensitivity) |
|
72 |
Q_PROPERTY(bool isSortLocaleAware READ isSortLocaleAware WRITE setSortLocaleAware) |
|
73 |
Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole) |
|
74 |
Q_PROPERTY(int filterRole READ filterRole WRITE setFilterRole) |
|
75 |
||
76 |
public: |
|
77 |
QSortFilterProxyModel(QObject *parent = 0); |
|
78 |
~QSortFilterProxyModel(); |
|
79 |
||
80 |
void setSourceModel(QAbstractItemModel *sourceModel); |
|
81 |
||
82 |
QModelIndex mapToSource(const QModelIndex &proxyIndex) const; |
|
83 |
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; |
|
84 |
||
85 |
QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const; |
|
86 |
QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const; |
|
87 |
||
88 |
QRegExp filterRegExp() const; |
|
89 |
void setFilterRegExp(const QRegExp ®Exp); |
|
90 |
||
91 |
int filterKeyColumn() const; |
|
92 |
void setFilterKeyColumn(int column); |
|
93 |
||
94 |
Qt::CaseSensitivity filterCaseSensitivity() const; |
|
95 |
void setFilterCaseSensitivity(Qt::CaseSensitivity cs); |
|
96 |
||
97 |
Qt::CaseSensitivity sortCaseSensitivity() const; |
|
98 |
void setSortCaseSensitivity(Qt::CaseSensitivity cs); |
|
99 |
||
100 |
bool isSortLocaleAware() const; |
|
101 |
void setSortLocaleAware(bool on); |
|
102 |
||
103 |
int sortColumn() const; |
|
104 |
Qt::SortOrder sortOrder() const; |
|
105 |
||
106 |
bool dynamicSortFilter() const; |
|
107 |
void setDynamicSortFilter(bool enable); |
|
108 |
||
109 |
int sortRole() const; |
|
110 |
void setSortRole(int role); |
|
111 |
||
112 |
int filterRole() const; |
|
113 |
void setFilterRole(int role); |
|
114 |
||
115 |
public Q_SLOTS: |
|
116 |
void setFilterRegExp(const QString &pattern); |
|
117 |
void setFilterWildcard(const QString &pattern); |
|
118 |
void setFilterFixedString(const QString &pattern); |
|
119 |
void clear(); |
|
120 |
void invalidate(); |
|
121 |
||
122 |
protected: |
|
123 |
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; |
|
124 |
virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const; |
|
125 |
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; |
|
126 |
||
127 |
void filterChanged(); |
|
128 |
void invalidateFilter(); |
|
129 |
||
130 |
public: |
|
131 |
#ifdef Q_NO_USING_KEYWORD |
|
132 |
inline QObject *parent() const { return QObject::parent(); } |
|
133 |
#else |
|
134 |
using QObject::parent; |
|
135 |
#endif |
|
136 |
||
137 |
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; |
|
138 |
QModelIndex parent(const QModelIndex &child) const; |
|
139 |
||
140 |
int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
141 |
int columnCount(const QModelIndex &parent = QModelIndex()) const; |
|
142 |
bool hasChildren(const QModelIndex &parent = QModelIndex()) const; |
|
143 |
||
144 |
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
|
145 |
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); |
|
146 |
||
147 |
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
|
148 |
bool setHeaderData(int section, Qt::Orientation orientation, |
|
149 |
const QVariant &value, int role = Qt::EditRole); |
|
150 |
||
151 |
QMimeData *mimeData(const QModelIndexList &indexes) const; |
|
152 |
bool dropMimeData(const QMimeData *data, Qt::DropAction action, |
|
153 |
int row, int column, const QModelIndex &parent); |
|
154 |
||
155 |
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); |
|
156 |
bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); |
|
157 |
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); |
|
158 |
bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); |
|
159 |
||
160 |
void fetchMore(const QModelIndex &parent); |
|
161 |
bool canFetchMore(const QModelIndex &parent) const; |
|
162 |
Qt::ItemFlags flags(const QModelIndex &index) const; |
|
163 |
||
164 |
QModelIndex buddy(const QModelIndex &index) const; |
|
165 |
QModelIndexList match(const QModelIndex &start, int role, |
|
166 |
const QVariant &value, int hits = 1, |
|
167 |
Qt::MatchFlags flags = |
|
168 |
Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const; |
|
169 |
QSize span(const QModelIndex &index) const; |
|
170 |
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); |
|
171 |
||
172 |
QStringList mimeTypes() const; |
|
173 |
Qt::DropActions supportedDropActions() const; |
|
174 |
private: |
|
175 |
Q_DECLARE_PRIVATE(QSortFilterProxyModel) |
|
176 |
Q_DISABLE_COPY(QSortFilterProxyModel) |
|
177 |
||
178 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right)) |
|
179 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end)) |
|
180 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceAboutToBeReset()) |
|
181 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceReset()) |
|
182 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged()) |
|
183 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutChanged()) |
|
184 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeInserted(const QModelIndex &source_parent, int start, int end)) |
|
185 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsInserted(const QModelIndex &source_parent, int start, int end)) |
|
186 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end)) |
|
187 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsRemoved(const QModelIndex &source_parent, int start, int end)) |
|
188 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeInserted(const QModelIndex &source_parent, int start, int end)) |
|
189 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsInserted(const QModelIndex &source_parent, int start, int end)) |
|
190 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end)) |
|
191 |
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsRemoved(const QModelIndex &source_parent, int start, int end)) |
|
192 |
}; |
|
193 |
||
194 |
QT_END_NAMESPACE |
|
195 |
||
196 |
QT_END_HEADER |
|
197 |
||
198 |
#endif // QT_NO_SORTFILTERPROXYMODEL |
|
199 |
||
200 |
#endif // QSORTFILTERPROXYMODEL_H |