Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the QtDocGallery module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
38 | ** $QT_END_LICENSE$ |
39 | ** |
40 | ****************************************************************************/ |
41 | |
42 | #ifndef QGALLERYQUERYMODEL_H |
43 | #define QGALLERYQUERYMODEL_H |
44 | |
45 | #include <qgalleryqueryrequest.h> |
46 | |
47 | #include <QtCore/qabstractitemmodel.h> |
48 | |
49 | QT_BEGIN_NAMESPACE_DOCGALLERY |
50 | |
51 | class QGalleryFilter; |
52 | class QGalleryResultSet; |
53 | |
54 | class QGalleryQueryModelPrivate; |
55 | |
56 | class Q_GALLERY_EXPORT QGalleryQueryModel : public QAbstractItemModel |
57 | { |
58 | Q_OBJECT |
59 | Q_PROPERTY(QAbstractGallery *gallery READ gallery WRITE setGallery NOTIFY galleryChanged) |
60 | Q_PROPERTY(QStringList sortPropertyNames READ sortPropertyNames WRITE setSortPropertyNames NOTIFY sortPropertyNamesChanged) |
61 | Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged) |
62 | Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged) |
63 | Q_PROPERTY(int limit READ limit WRITE setLimit NOTIFY limitChanged) |
64 | Q_PROPERTY(QString rootType READ rootType WRITE setRootType NOTIFY rootTypeChanged) |
65 | Q_PROPERTY(QVariant rootItem READ rootItem WRITE setRootItem NOTIFY rootItemChanged) |
66 | Q_PROPERTY(QGalleryQueryRequest::Scope scope READ scope WRITE setScope NOTIFY scopeChanged) |
67 | Q_PROPERTY(QGalleryFilter filter READ filter WRITE setFilter NOTIFY filterChanged) |
68 | Q_PROPERTY(int error READ error NOTIFY errorChanged) |
69 | Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) |
70 | Q_PROPERTY(QGalleryAbstractRequest::State state READ state NOTIFY stateChanged) |
71 | public: |
72 | QGalleryQueryModel(QObject *parent = Q_NULLPTR); |
73 | QGalleryQueryModel(QAbstractGallery *gallery, QObject *parent = Q_NULLPTR); |
74 | ~QGalleryQueryModel(); |
75 | |
76 | QAbstractGallery *gallery() const; |
77 | void setGallery(QAbstractGallery *gallery); |
78 | |
79 | QHash<int, QString> roleProperties(int column) const; |
80 | void setRoleProperties(int column, const QHash<int, QString> &properties); |
81 | |
82 | void addColumn(const QHash<int, QString> &properties); |
83 | void addColumn(const QString &property, int role = Qt::DisplayRole); |
84 | void insertColumn(int index, const QHash<int, QString> &properties); |
85 | void insertColumn(int index, const QString &property, int role = Qt::DisplayRole); |
86 | void removeColumn(int index); |
87 | |
88 | QStringList sortPropertyNames() const; |
89 | void setSortPropertyNames(const QStringList &names); |
90 | |
91 | bool autoUpdate() const; |
92 | void setAutoUpdate(bool enabled); |
93 | |
94 | int offset() const; |
95 | void setOffset(int offset); |
96 | |
97 | int limit() const; |
98 | void setLimit(int limit); |
99 | |
100 | QString rootType() const; |
101 | void setRootType(const QString &itemType); |
102 | |
103 | QVariant rootItem() const; |
104 | void setRootItem(const QVariant &itemId); |
105 | |
106 | QGalleryQueryRequest::Scope scope() const; |
107 | void setScope(QGalleryQueryRequest::Scope scope); |
108 | |
109 | QGalleryFilter filter() const; |
110 | void setFilter(const QGalleryFilter &filter); |
111 | |
112 | void execute(); |
113 | void cancel(); |
114 | void clear(); |
115 | |
116 | int error() const; |
117 | QString errorString() const; |
118 | |
119 | QGalleryAbstractRequest::State state() const; |
120 | |
121 | QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; |
122 | QModelIndex parent(const QModelIndex &index) const; |
123 | |
124 | int rowCount(const QModelIndex &parent = QModelIndex()) const; |
125 | int columnCount(const QModelIndex &parent = QModelIndex()) const; |
126 | |
127 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
128 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); |
129 | |
130 | QVariant itemId(const QModelIndex &index) const; |
131 | QUrl itemUrl(const QModelIndex &index) const; |
132 | QString itemType(const QModelIndex &index) const; |
133 | |
134 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
135 | bool setHeaderData( |
136 | int section, |
137 | Qt::Orientation orientation, |
138 | const QVariant &value, |
139 | int role = Qt::EditRole); |
140 | |
141 | Qt::ItemFlags flags(const QModelIndex &index) const; |
142 | |
143 | Q_SIGNALS: |
144 | void galleryChanged(); |
145 | void sortPropertyNamesChanged(); |
146 | void autoUpdateChanged(); |
147 | void offsetChanged(); |
148 | void limitChanged(); |
149 | void rootTypeChanged(); |
150 | void rootItemChanged(); |
151 | void scopeChanged(); |
152 | void filterChanged(); |
153 | void finished(); |
154 | void canceled(); |
155 | void error(int error, const QString &errorString); |
156 | void errorChanged(); |
157 | void stateChanged(QGalleryAbstractRequest::State state); |
158 | |
159 | private: |
160 | QScopedPointer<QGalleryQueryModelPrivate> d_ptr; |
161 | |
162 | Q_DECLARE_PRIVATE(QGalleryQueryModel) |
163 | Q_PRIVATE_SLOT(d_func(), void _q_resultSetChanged(QGalleryResultSet*)) |
164 | Q_PRIVATE_SLOT(d_func(), void _q_itemsInserted(int, int)) |
165 | Q_PRIVATE_SLOT(d_func(), void _q_itemsRemoved(int, int)) |
166 | Q_PRIVATE_SLOT(d_func(), void _q_itemsMoved(int, int, int)) |
167 | Q_PRIVATE_SLOT(d_func(), void _q_metaDataChanged(int, int, const QList<int> &)) |
168 | }; |
169 | |
170 | QT_END_NAMESPACE_DOCGALLERY |
171 | |
172 | #endif |
173 |
Warning: That file was not part of the compilation database. It may have many parsing errors.