Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/types/qqmldelegatemodel_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
4 | ** Contact: https://www.qt.io/licensing/ | - |
5 | ** | - |
6 | ** This file is part of the QtQml 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 The Qt Company. For licensing terms | - |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
24 | ** | - |
25 | ** GNU General Public License Usage | - |
26 | ** Alternatively, this file may be used under the terms of the GNU | - |
27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
28 | ** Public license version 3 or any later version approved by the KDE Free | - |
29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
31 | ** included in the packaging of this file. Please review the following | - |
32 | ** information to ensure the GNU General Public License requirements will | - |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
35 | ** | - |
36 | ** $QT_END_LICENSE$ | - |
37 | ** | - |
38 | ****************************************************************************/ | - |
39 | - | |
40 | #ifndef QQMLDATAMODEL_P_H | - |
41 | #define QQMLDATAMODEL_P_H | - |
42 | - | |
43 | // | - |
44 | // W A R N I N G | - |
45 | // ------------- | - |
46 | // | - |
47 | // This file is not part of the Qt API. It exists purely as an | - |
48 | // implementation detail. This header file may change from version to | - |
49 | // version without notice, or even be removed. | - |
50 | // | - |
51 | // We mean it. | - |
52 | // | - |
53 | - | |
54 | #include <private/qtqmlglobal_p.h> | - |
55 | #include <private/qqmllistcompositor_p.h> | - |
56 | #include <private/qqmlobjectmodel_p.h> | - |
57 | #include <private/qqmlincubator_p.h> | - |
58 | - | |
59 | #include <QtCore/qabstractitemmodel.h> | - |
60 | #include <QtCore/qstringlist.h> | - |
61 | - | |
62 | #include <private/qv8engine_p.h> | - |
63 | #include <private/qqmlglobal_p.h> | - |
64 | - | |
65 | QT_REQUIRE_CONFIG(qml_delegate_model); | - |
66 | - | |
67 | QT_BEGIN_NAMESPACE | - |
68 | - | |
69 | class QQmlChangeSet; | - |
70 | class QQmlComponent; | - |
71 | class QQuickPackage; | - |
72 | class QQmlV4Function; | - |
73 | class QQmlDelegateModelGroup; | - |
74 | class QQmlDelegateModelAttached; | - |
75 | class QQmlDelegateModelPrivate; | - |
76 | - | |
77 | - | |
78 | class Q_QML_PRIVATE_EXPORT QQmlDelegateModel : public QQmlInstanceModel, public QQmlParserStatus | - |
79 | { | - |
80 | Q_OBJECT | - |
81 | Q_DECLARE_PRIVATE(QQmlDelegateModel) executed 315762 times by 27 tests: return reinterpret_cast<QQmlDelegateModelPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 652908 times by 26 tests: return reinterpret_cast<const QQmlDelegateModelPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 315762-652908 |
82 | - | |
83 | Q_PROPERTY(QVariant model READ model WRITE setModel) | - |
84 | Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate) | - |
85 | Q_PROPERTY(QString filterOnGroup READ filterGroup WRITE setFilterGroup NOTIFY filterGroupChanged RESET resetFilterGroup) | - |
86 | Q_PROPERTY(QQmlDelegateModelGroup *items READ items CONSTANT) //TODO : worth renaming? | - |
87 | Q_PROPERTY(QQmlDelegateModelGroup *persistedItems READ persistedItems CONSTANT) | - |
88 | Q_PROPERTY(QQmlListProperty<QQmlDelegateModelGroup> groups READ groups CONSTANT) | - |
89 | Q_PROPERTY(QObject *parts READ parts CONSTANT) | - |
90 | Q_PROPERTY(QVariant rootIndex READ rootIndex WRITE setRootIndex NOTIFY rootIndexChanged) | - |
91 | Q_PROPERTY(int rows READ rows NOTIFY rowsChanged REVISION 12) | - |
92 | Q_PROPERTY(int columns READ columns NOTIFY columnsChanged REVISION 12) | - |
93 | Q_CLASSINFO("DefaultProperty", "delegate") | - |
94 | Q_INTERFACES(QQmlParserStatus) | - |
95 | public: | - |
96 | QQmlDelegateModel(); | - |
97 | QQmlDelegateModel(QQmlContext *, QObject *parent=nullptr); | - |
98 | ~QQmlDelegateModel(); | - |
99 | - | |
100 | void classBegin() override; | - |
101 | void componentComplete() override; | - |
102 | - | |
103 | QVariant model() const; | - |
104 | void setModel(const QVariant &); | - |
105 | - | |
106 | QQmlComponent *delegate() const; | - |
107 | void setDelegate(QQmlComponent *); | - |
108 | - | |
109 | QVariant rootIndex() const; | - |
110 | void setRootIndex(const QVariant &root); | - |
111 | - | |
112 | int rows() const; | - |
113 | int columns() const; | - |
114 | - | |
115 | Q_INVOKABLE QVariant modelIndex(int idx) const; | - |
116 | Q_INVOKABLE QVariant parentModelIndex() const; | - |
117 | - | |
118 | int count() const override; | - |
119 | bool isValid() const override { return delegate() != nullptr; } never executed: return delegate() != nullptr; | 0 |
120 | QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override; | - |
121 | ReleaseFlags release(QObject *object) override; | - |
122 | void cancel(int index) override; | - |
123 | QString stringValue(int index, const QString &role) override; | - |
124 | void setWatchedRoles(const QList<QByteArray> &roles) override; | - |
125 | QQmlIncubator::Status incubationStatus(int index) override; | - |
126 | - | |
127 | int indexOf(QObject *object, QObject *objectContext) const override; | - |
128 | - | |
129 | QString filterGroup() const; | - |
130 | void setFilterGroup(const QString &group); | - |
131 | void resetFilterGroup(); | - |
132 | - | |
133 | QQmlDelegateModelGroup *items(); | - |
134 | QQmlDelegateModelGroup *persistedItems(); | - |
135 | QQmlListProperty<QQmlDelegateModelGroup> groups(); | - |
136 | QObject *parts(); | - |
137 | - | |
138 | const QAbstractItemModel *abstractItemModel() const override; | - |
139 | - | |
140 | bool event(QEvent *) override; | - |
141 | - | |
142 | static QQmlDelegateModelAttached *qmlAttachedProperties(QObject *obj); | - |
143 | - | |
144 | Q_SIGNALS: | - |
145 | void filterGroupChanged(); | - |
146 | void defaultGroupsChanged(); | - |
147 | void rootIndexChanged(); | - |
148 | Q_REVISION(12) void rowsChanged(); | - |
149 | Q_REVISION(12) void columnsChanged(); | - |
150 | - | |
151 | private Q_SLOTS: | - |
152 | void _q_itemsChanged(int index, int count, const QVector<int> &roles); | - |
153 | void _q_itemsInserted(int index, int count); | - |
154 | void _q_itemsRemoved(int index, int count); | - |
155 | void _q_itemsMoved(int from, int to, int count); | - |
156 | void _q_modelReset(); | - |
157 | void _q_rowsInserted(const QModelIndex &,int,int); | - |
158 | void _q_rowsAboutToBeRemoved(const QModelIndex &parent, int begin, int end); | - |
159 | void _q_rowsRemoved(const QModelIndex &,int,int); | - |
160 | void _q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int); | - |
161 | void _q_dataChanged(const QModelIndex&,const QModelIndex&,const QVector<int> &); | - |
162 | void _q_layoutChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint); | - |
163 | - | |
164 | private: | - |
165 | bool isDescendantOf(const QPersistentModelIndex &desc, const QList<QPersistentModelIndex> &parents) const; | - |
166 | - | |
167 | Q_DISABLE_COPY(QQmlDelegateModel) | - |
168 | }; | - |
169 | - | |
170 | class QQmlDelegateModelGroupPrivate; | - |
171 | class Q_QML_PRIVATE_EXPORT QQmlDelegateModelGroup : public QObject | - |
172 | { | - |
173 | Q_OBJECT | - |
174 | Q_PROPERTY(int count READ count NOTIFY countChanged) | - |
175 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) | - |
176 | Q_PROPERTY(bool includeByDefault READ defaultInclude WRITE setDefaultInclude NOTIFY defaultIncludeChanged) | - |
177 | public: | - |
178 | QQmlDelegateModelGroup(QObject *parent = nullptr); | - |
179 | QQmlDelegateModelGroup(const QString &name, QQmlDelegateModel *model, int compositorType, QObject *parent = nullptr); | - |
180 | ~QQmlDelegateModelGroup(); | - |
181 | - | |
182 | QString name() const; | - |
183 | void setName(const QString &name); | - |
184 | - | |
185 | int count() const; | - |
186 | - | |
187 | bool defaultInclude() const; | - |
188 | void setDefaultInclude(bool include); | - |
189 | - | |
190 | Q_INVOKABLE QQmlV4Handle get(int index); | - |
191 | - | |
192 | public Q_SLOTS: | - |
193 | void insert(QQmlV4Function *); | - |
194 | void create(QQmlV4Function *); | - |
195 | void resolve(QQmlV4Function *); | - |
196 | void remove(QQmlV4Function *); | - |
197 | void addGroups(QQmlV4Function *); | - |
198 | void removeGroups(QQmlV4Function *); | - |
199 | void setGroups(QQmlV4Function *); | - |
200 | void move(QQmlV4Function *); | - |
201 | - | |
202 | Q_SIGNALS: | - |
203 | void countChanged(); | - |
204 | void nameChanged(); | - |
205 | void defaultIncludeChanged(); | - |
206 | void changed(const QQmlV4Handle &removed, const QQmlV4Handle &inserted); | - |
207 | private: | - |
208 | Q_DECLARE_PRIVATE(QQmlDelegateModelGroup) executed 46496 times by 27 tests: return reinterpret_cast<QQmlDelegateModelGroupPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 3194 times by 2 tests: return reinterpret_cast<const QQmlDelegateModelGroupPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 3194-46496 |
209 | }; | - |
210 | - | |
211 | class QQmlDelegateModelItem; | - |
212 | class QQmlDelegateModelAttachedMetaObject; | - |
213 | class QQmlDelegateModelAttached : public QObject | - |
214 | { | - |
215 | Q_OBJECT | - |
216 | Q_PROPERTY(QQmlDelegateModel *model READ model CONSTANT) | - |
217 | Q_PROPERTY(QStringList groups READ groups WRITE setGroups NOTIFY groupsChanged) | - |
218 | Q_PROPERTY(bool isUnresolved READ isUnresolved NOTIFY unresolvedChanged) | - |
219 | public: | - |
220 | QQmlDelegateModelAttached(QObject *parent); | - |
221 | QQmlDelegateModelAttached(QQmlDelegateModelItem *cacheItem, QObject *parent); | - |
222 | ~QQmlDelegateModelAttached() {} | - |
223 | - | |
224 | void resetCurrentIndex(); | - |
225 | void setCacheItem(QQmlDelegateModelItem *item); | - |
226 | - | |
227 | QQmlDelegateModel *model() const; | - |
228 | - | |
229 | QStringList groups() const; | - |
230 | void setGroups(const QStringList &groups); | - |
231 | - | |
232 | bool isUnresolved() const; | - |
233 | - | |
234 | void emitChanges(); | - |
235 | - | |
236 | void emitUnresolvedChanged() { Q_EMIT unresolvedChanged(); } never executed: end of block | 0 |
237 | - | |
238 | Q_SIGNALS: | - |
239 | void groupsChanged(); | - |
240 | void unresolvedChanged(); | - |
241 | - | |
242 | public: | - |
243 | QQmlDelegateModelItem *m_cacheItem; | - |
244 | int m_previousGroups; | - |
245 | int m_currentIndex[QQmlListCompositor::MaximumGroupCount]; | - |
246 | int m_previousIndex[QQmlListCompositor::MaximumGroupCount]; | - |
247 | - | |
248 | friend class QQmlDelegateModelAttachedMetaObject; | - |
249 | }; | - |
250 | - | |
251 | QT_END_NAMESPACE | - |
252 | - | |
253 | QML_DECLARE_TYPE(QQmlDelegateModel) | - |
254 | QML_DECLARE_TYPEINFO(QQmlDelegateModel, QML_HAS_ATTACHED_PROPERTIES) | - |
255 | QML_DECLARE_TYPE(QQmlDelegateModelGroup) | - |
256 | - | |
257 | #endif // QQMLDATAMODEL_P_H | - |
Source code | Switch to Preprocessed file |