Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickitemview_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 QtQuick 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 QQUICKITEMVIEW_P_H | - | ||||||
41 | #define QQUICKITEMVIEW_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 <QtQuick/private/qtquickglobal_p.h> | - | ||||||
55 | - | |||||||
56 | QT_REQUIRE_CONFIG(quick_itemview); | - | ||||||
57 | - | |||||||
58 | #include "qquickflickable_p.h" | - | ||||||
59 | #include <qpointer.h> | - | ||||||
60 | #include <QtCore/QLoggingCategory> | - | ||||||
61 | - | |||||||
62 | QT_BEGIN_NAMESPACE | - | ||||||
63 | - | |||||||
64 | Q_DECLARE_LOGGING_CATEGORY(lcItemViewDelegateLifecycle) | - | ||||||
65 | - | |||||||
66 | class QQmlChangeSet; | - | ||||||
67 | - | |||||||
68 | class QQuickItemViewPrivate; | - | ||||||
69 | - | |||||||
70 | class Q_QUICK_PRIVATE_EXPORT QQuickItemView : public QQuickFlickable | - | ||||||
71 | { | - | ||||||
72 | Q_OBJECT | - | ||||||
73 | - | |||||||
74 | Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) | - | ||||||
75 | Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) | - | ||||||
76 | Q_PROPERTY(int count READ count NOTIFY countChanged) | - | ||||||
77 | - | |||||||
78 | Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) | - | ||||||
79 | Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged) | - | ||||||
80 | - | |||||||
81 | Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) | - | ||||||
82 | Q_PROPERTY(bool keyNavigationEnabled READ isKeyNavigationEnabled WRITE setKeyNavigationEnabled NOTIFY keyNavigationEnabledChanged REVISION 7) | - | ||||||
83 | Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) | - | ||||||
84 | Q_PROPERTY(int displayMarginBeginning READ displayMarginBeginning WRITE setDisplayMarginBeginning NOTIFY displayMarginBeginningChanged REVISION 2) | - | ||||||
85 | Q_PROPERTY(int displayMarginEnd READ displayMarginEnd WRITE setDisplayMarginEnd NOTIFY displayMarginEndChanged REVISION 2) | - | ||||||
86 | - | |||||||
87 | Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) | - | ||||||
88 | Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged) | - | ||||||
89 | Q_PROPERTY(VerticalLayoutDirection verticalLayoutDirection READ verticalLayoutDirection WRITE setVerticalLayoutDirection NOTIFY verticalLayoutDirectionChanged) | - | ||||||
90 | - | |||||||
91 | Q_PROPERTY(QQmlComponent *header READ header WRITE setHeader NOTIFY headerChanged) | - | ||||||
92 | Q_PROPERTY(QQuickItem *headerItem READ headerItem NOTIFY headerItemChanged) | - | ||||||
93 | Q_PROPERTY(QQmlComponent *footer READ footer WRITE setFooter NOTIFY footerChanged) | - | ||||||
94 | Q_PROPERTY(QQuickItem *footerItem READ footerItem NOTIFY footerItemChanged) | - | ||||||
95 | - | |||||||
96 | Q_PROPERTY(QQuickTransition *populate READ populateTransition WRITE setPopulateTransition NOTIFY populateTransitionChanged) | - | ||||||
97 | Q_PROPERTY(QQuickTransition *add READ addTransition WRITE setAddTransition NOTIFY addTransitionChanged) | - | ||||||
98 | Q_PROPERTY(QQuickTransition *addDisplaced READ addDisplacedTransition WRITE setAddDisplacedTransition NOTIFY addDisplacedTransitionChanged) | - | ||||||
99 | Q_PROPERTY(QQuickTransition *move READ moveTransition WRITE setMoveTransition NOTIFY moveTransitionChanged) | - | ||||||
100 | Q_PROPERTY(QQuickTransition *moveDisplaced READ moveDisplacedTransition WRITE setMoveDisplacedTransition NOTIFY moveDisplacedTransitionChanged) | - | ||||||
101 | Q_PROPERTY(QQuickTransition *remove READ removeTransition WRITE setRemoveTransition NOTIFY removeTransitionChanged) | - | ||||||
102 | Q_PROPERTY(QQuickTransition *removeDisplaced READ removeDisplacedTransition WRITE setRemoveDisplacedTransition NOTIFY removeDisplacedTransitionChanged) | - | ||||||
103 | Q_PROPERTY(QQuickTransition *displaced READ displacedTransition WRITE setDisplacedTransition NOTIFY displacedTransitionChanged) | - | ||||||
104 | - | |||||||
105 | Q_PROPERTY(QQmlComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) | - | ||||||
106 | Q_PROPERTY(QQuickItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) | - | ||||||
107 | Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem NOTIFY highlightFollowsCurrentItemChanged) | - | ||||||
108 | Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) | - | ||||||
109 | Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged RESET resetPreferredHighlightBegin) | - | ||||||
110 | Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged RESET resetPreferredHighlightEnd) | - | ||||||
111 | Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) | - | ||||||
112 | - | |||||||
113 | public: | - | ||||||
114 | // this holds all layout enum values so they can be referred to by other enums | - | ||||||
115 | // to ensure consistent values - e.g. QML references to GridView.TopToBottom flow | - | ||||||
116 | // and GridView.TopToBottom vertical layout direction should have same value | - | ||||||
117 | enum LayoutDirection { | - | ||||||
118 | LeftToRight = Qt::LeftToRight, | - | ||||||
119 | RightToLeft = Qt::RightToLeft, | - | ||||||
120 | VerticalTopToBottom, | - | ||||||
121 | VerticalBottomToTop | - | ||||||
122 | }; | - | ||||||
123 | Q_ENUM(LayoutDirection) | - | ||||||
124 | - | |||||||
125 | enum VerticalLayoutDirection { | - | ||||||
126 | TopToBottom = VerticalTopToBottom, | - | ||||||
127 | BottomToTop = VerticalBottomToTop | - | ||||||
128 | }; | - | ||||||
129 | Q_ENUM(VerticalLayoutDirection) | - | ||||||
130 | - | |||||||
131 | QQuickItemView(QQuickFlickablePrivate &dd, QQuickItem *parent = nullptr); | - | ||||||
132 | ~QQuickItemView(); | - | ||||||
133 | - | |||||||
134 | QVariant model() const; | - | ||||||
135 | void setModel(const QVariant &); | - | ||||||
136 | - | |||||||
137 | QQmlComponent *delegate() const; | - | ||||||
138 | void setDelegate(QQmlComponent *); | - | ||||||
139 | - | |||||||
140 | int count() const; | - | ||||||
141 | - | |||||||
142 | int currentIndex() const; | - | ||||||
143 | void setCurrentIndex(int idx); | - | ||||||
144 | - | |||||||
145 | QQuickItem *currentItem() const; | - | ||||||
146 | - | |||||||
147 | bool isWrapEnabled() const; | - | ||||||
148 | void setWrapEnabled(bool); | - | ||||||
149 | - | |||||||
150 | bool isKeyNavigationEnabled() const; | - | ||||||
151 | void setKeyNavigationEnabled(bool); | - | ||||||
152 | - | |||||||
153 | int cacheBuffer() const; | - | ||||||
154 | void setCacheBuffer(int); | - | ||||||
155 | - | |||||||
156 | int displayMarginBeginning() const; | - | ||||||
157 | void setDisplayMarginBeginning(int); | - | ||||||
158 | - | |||||||
159 | int displayMarginEnd() const; | - | ||||||
160 | void setDisplayMarginEnd(int); | - | ||||||
161 | - | |||||||
162 | Qt::LayoutDirection layoutDirection() const; | - | ||||||
163 | void setLayoutDirection(Qt::LayoutDirection); | - | ||||||
164 | Qt::LayoutDirection effectiveLayoutDirection() const; | - | ||||||
165 | - | |||||||
166 | VerticalLayoutDirection verticalLayoutDirection() const; | - | ||||||
167 | void setVerticalLayoutDirection(VerticalLayoutDirection layoutDirection); | - | ||||||
168 | - | |||||||
169 | QQmlComponent *footer() const; | - | ||||||
170 | void setFooter(QQmlComponent *); | - | ||||||
171 | QQuickItem *footerItem() const; | - | ||||||
172 | - | |||||||
173 | QQmlComponent *header() const; | - | ||||||
174 | void setHeader(QQmlComponent *); | - | ||||||
175 | QQuickItem *headerItem() const; | - | ||||||
176 | - | |||||||
177 | QQuickTransition *populateTransition() const; | - | ||||||
178 | void setPopulateTransition(QQuickTransition *transition); | - | ||||||
179 | - | |||||||
180 | QQuickTransition *addTransition() const; | - | ||||||
181 | void setAddTransition(QQuickTransition *transition); | - | ||||||
182 | - | |||||||
183 | QQuickTransition *addDisplacedTransition() const; | - | ||||||
184 | void setAddDisplacedTransition(QQuickTransition *transition); | - | ||||||
185 | - | |||||||
186 | QQuickTransition *moveTransition() const; | - | ||||||
187 | void setMoveTransition(QQuickTransition *transition); | - | ||||||
188 | - | |||||||
189 | QQuickTransition *moveDisplacedTransition() const; | - | ||||||
190 | void setMoveDisplacedTransition(QQuickTransition *transition); | - | ||||||
191 | - | |||||||
192 | QQuickTransition *removeTransition() const; | - | ||||||
193 | void setRemoveTransition(QQuickTransition *transition); | - | ||||||
194 | - | |||||||
195 | QQuickTransition *removeDisplacedTransition() const; | - | ||||||
196 | void setRemoveDisplacedTransition(QQuickTransition *transition); | - | ||||||
197 | - | |||||||
198 | QQuickTransition *displacedTransition() const; | - | ||||||
199 | void setDisplacedTransition(QQuickTransition *transition); | - | ||||||
200 | - | |||||||
201 | QQmlComponent *highlight() const; | - | ||||||
202 | void setHighlight(QQmlComponent *); | - | ||||||
203 | - | |||||||
204 | QQuickItem *highlightItem() const; | - | ||||||
205 | - | |||||||
206 | bool highlightFollowsCurrentItem() const; | - | ||||||
207 | virtual void setHighlightFollowsCurrentItem(bool); | - | ||||||
208 | - | |||||||
209 | enum HighlightRangeMode { NoHighlightRange, ApplyRange, StrictlyEnforceRange }; | - | ||||||
210 | Q_ENUM(HighlightRangeMode) | - | ||||||
211 | HighlightRangeMode highlightRangeMode() const; | - | ||||||
212 | void setHighlightRangeMode(HighlightRangeMode mode); | - | ||||||
213 | - | |||||||
214 | qreal preferredHighlightBegin() const; | - | ||||||
215 | void setPreferredHighlightBegin(qreal); | - | ||||||
216 | void resetPreferredHighlightBegin(); | - | ||||||
217 | - | |||||||
218 | qreal preferredHighlightEnd() const; | - | ||||||
219 | void setPreferredHighlightEnd(qreal); | - | ||||||
220 | void resetPreferredHighlightEnd(); | - | ||||||
221 | - | |||||||
222 | int highlightMoveDuration() const; | - | ||||||
223 | virtual void setHighlightMoveDuration(int); | - | ||||||
224 | - | |||||||
225 | enum PositionMode { Beginning, Center, End, Visible, Contain, SnapPosition }; | - | ||||||
226 | Q_ENUM(PositionMode) | - | ||||||
227 | - | |||||||
228 | Q_INVOKABLE void positionViewAtIndex(int index, int mode); | - | ||||||
229 | Q_INVOKABLE int indexAt(qreal x, qreal y) const; | - | ||||||
230 | Q_INVOKABLE QQuickItem *itemAt(qreal x, qreal y) const; | - | ||||||
231 | Q_INVOKABLE void positionViewAtBeginning(); | - | ||||||
232 | Q_INVOKABLE void positionViewAtEnd(); | - | ||||||
233 | Q_REVISION(1) Q_INVOKABLE void forceLayout(); | - | ||||||
234 | - | |||||||
235 | void setContentX(qreal pos) override; | - | ||||||
236 | void setContentY(qreal pos) override; | - | ||||||
237 | qreal originX() const override; | - | ||||||
238 | qreal originY() const override; | - | ||||||
239 | - | |||||||
240 | Q_SIGNALS: | - | ||||||
241 | void modelChanged(); | - | ||||||
242 | void delegateChanged(); | - | ||||||
243 | void countChanged(); | - | ||||||
244 | void currentIndexChanged(); | - | ||||||
245 | void currentItemChanged(); | - | ||||||
246 | - | |||||||
247 | void keyNavigationWrapsChanged(); | - | ||||||
248 | Q_REVISION(7) void keyNavigationEnabledChanged(); | - | ||||||
249 | void cacheBufferChanged(); | - | ||||||
250 | void displayMarginBeginningChanged(); | - | ||||||
251 | void displayMarginEndChanged(); | - | ||||||
252 | - | |||||||
253 | void layoutDirectionChanged(); | - | ||||||
254 | void effectiveLayoutDirectionChanged(); | - | ||||||
255 | void verticalLayoutDirectionChanged(); | - | ||||||
256 | - | |||||||
257 | void headerChanged(); | - | ||||||
258 | void footerChanged(); | - | ||||||
259 | void headerItemChanged(); | - | ||||||
260 | void footerItemChanged(); | - | ||||||
261 | - | |||||||
262 | void populateTransitionChanged(); | - | ||||||
263 | void addTransitionChanged(); | - | ||||||
264 | void addDisplacedTransitionChanged(); | - | ||||||
265 | void moveTransitionChanged(); | - | ||||||
266 | void moveDisplacedTransitionChanged(); | - | ||||||
267 | void removeTransitionChanged(); | - | ||||||
268 | void removeDisplacedTransitionChanged(); | - | ||||||
269 | void displacedTransitionChanged(); | - | ||||||
270 | - | |||||||
271 | void highlightChanged(); | - | ||||||
272 | void highlightItemChanged(); | - | ||||||
273 | void highlightFollowsCurrentItemChanged(); | - | ||||||
274 | void highlightRangeModeChanged(); | - | ||||||
275 | void preferredHighlightBeginChanged(); | - | ||||||
276 | void preferredHighlightEndChanged(); | - | ||||||
277 | void highlightMoveDurationChanged(); | - | ||||||
278 | - | |||||||
279 | protected: | - | ||||||
280 | void updatePolish() override; | - | ||||||
281 | void componentComplete() override; | - | ||||||
282 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; | - | ||||||
283 | qreal minYExtent() const override; | - | ||||||
284 | qreal maxYExtent() const override; | - | ||||||
285 | qreal minXExtent() const override; | - | ||||||
286 | qreal maxXExtent() const override; | - | ||||||
287 | - | |||||||
288 | protected Q_SLOTS: | - | ||||||
289 | void destroyRemoved(); | - | ||||||
290 | void createdItem(int index, QObject *item); | - | ||||||
291 | virtual void initItem(int index, QObject *item); | - | ||||||
292 | void modelUpdated(const QQmlChangeSet &changeSet, bool reset); | - | ||||||
293 | void destroyingItem(QObject *item); | - | ||||||
294 | void animStopped(); | - | ||||||
295 | void trackedPositionChanged(); | - | ||||||
296 | - | |||||||
297 | private: | - | ||||||
298 | Q_DECLARE_PRIVATE(QQuickItemView) executed 290718 times by 12 tests: return reinterpret_cast<QQuickItemViewPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 2474325 times by 12 tests: return reinterpret_cast<const QQuickItemViewPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 290718-2474325 | ||||||
299 | }; | - | ||||||
300 | - | |||||||
301 | - | |||||||
302 | class Q_QUICK_PRIVATE_EXPORT QQuickItemViewAttached : public QObject | - | ||||||
303 | { | - | ||||||
304 | Q_OBJECT | - | ||||||
305 | - | |||||||
306 | Q_PROPERTY(QQuickItemView *view READ view NOTIFY viewChanged) | - | ||||||
307 | Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) | - | ||||||
308 | Q_PROPERTY(bool delayRemove READ delayRemove WRITE setDelayRemove NOTIFY delayRemoveChanged) | - | ||||||
309 | - | |||||||
310 | Q_PROPERTY(QString section READ section NOTIFY sectionChanged) | - | ||||||
311 | Q_PROPERTY(QString previousSection READ prevSection NOTIFY prevSectionChanged) | - | ||||||
312 | Q_PROPERTY(QString nextSection READ nextSection NOTIFY nextSectionChanged) | - | ||||||
313 | - | |||||||
314 | public: | - | ||||||
315 | QQuickItemViewAttached(QObject *parent) | - | ||||||
316 | : QObject(parent), m_isCurrent(false), m_delayRemove(false) {} executed 80989 times by 11 tests: end of block Executed by:
| 80989 | ||||||
317 | ~QQuickItemViewAttached() {} | - | ||||||
318 | - | |||||||
319 | QQuickItemView *view() const { return m_view; } executed 1216 times by 4 tests: return m_view; Executed by:
| 1216 | ||||||
320 | void setView(QQuickItemView *view) { | - | ||||||
321 | if (view != m_view) {
| 80899-83308 | ||||||
322 | m_view = view; | - | ||||||
323 | Q_EMIT viewChanged(); | - | ||||||
324 | } executed 80899 times by 11 tests: end of block Executed by:
| 80899 | ||||||
325 | } executed 164207 times by 11 tests: end of block Executed by:
| 164207 | ||||||
326 | - | |||||||
327 | bool isCurrentItem() const { return m_isCurrent; } executed 71234 times by 4 tests: return m_isCurrent; Executed by:
| 71234 | ||||||
328 | void setIsCurrentItem(bool c) { | - | ||||||
329 | if (m_isCurrent != c) {
| 824-7638 | ||||||
330 | m_isCurrent = c; | - | ||||||
331 | Q_EMIT currentItemChanged(); | - | ||||||
332 | } executed 7638 times by 11 tests: end of block Executed by:
| 7638 | ||||||
333 | } executed 8462 times by 11 tests: end of block Executed by:
| 8462 | ||||||
334 | - | |||||||
335 | bool delayRemove() const { return m_delayRemove; } executed 14833 times by 4 tests: return m_delayRemove; Executed by:
| 14833 | ||||||
336 | void setDelayRemove(bool delay) { | - | ||||||
337 | if (m_delayRemove != delay) {
| 84-210 | ||||||
338 | m_delayRemove = delay; | - | ||||||
339 | Q_EMIT delayRemoveChanged(); | - | ||||||
340 | } executed 210 times by 3 tests: end of block Executed by:
| 210 | ||||||
341 | } executed 294 times by 3 tests: end of block Executed by:
| 294 | ||||||
342 | - | |||||||
343 | QString section() const { return m_section; } executed 16705 times by 4 tests: return m_section; Executed by:
| 16705 | ||||||
344 | void setSection(const QString §) { | - | ||||||
345 | if (m_section != sect) {
| 873-5301 | ||||||
346 | m_section = sect; | - | ||||||
347 | Q_EMIT sectionChanged(); | - | ||||||
348 | } executed 873 times by 2 tests: end of block Executed by:
| 873 | ||||||
349 | } executed 6174 times by 4 tests: end of block Executed by:
| 6174 | ||||||
350 | - | |||||||
351 | QString prevSection() const { return m_prevSection; } executed 2042 times by 1 test: return m_prevSection; Executed by:
| 2042 | ||||||
352 | void setPrevSection(const QString §) { | - | ||||||
353 | if (m_prevSection != sect) {
| 824-5388 | ||||||
354 | m_prevSection = sect; | - | ||||||
355 | Q_EMIT prevSectionChanged(); | - | ||||||
356 | } executed 824 times by 2 tests: end of block Executed by:
| 824 | ||||||
357 | } executed 6212 times by 4 tests: end of block Executed by:
| 6212 | ||||||
358 | - | |||||||
359 | QString nextSection() const { return m_nextSection; } executed 1634 times by 1 test: return m_nextSection; Executed by:
| 1634 | ||||||
360 | void setNextSection(const QString §) { | - | ||||||
361 | if (m_nextSection != sect) {
| 885-5327 | ||||||
362 | m_nextSection = sect; | - | ||||||
363 | Q_EMIT nextSectionChanged(); | - | ||||||
364 | } executed 885 times by 3 tests: end of block Executed by:
| 885 | ||||||
365 | } executed 6212 times by 4 tests: end of block Executed by:
| 6212 | ||||||
366 | - | |||||||
367 | void setSections(const QString &prev, const QString §, const QString &next) { | - | ||||||
368 | bool prevChanged = prev != m_prevSection; | - | ||||||
369 | bool sectChanged = sect != m_section; | - | ||||||
370 | bool nextChanged = next != m_nextSection; | - | ||||||
371 | m_prevSection = prev; | - | ||||||
372 | m_section = sect; | - | ||||||
373 | m_nextSection = next; | - | ||||||
374 | if (prevChanged)
| 112-508 | ||||||
375 | Q_EMIT prevSectionChanged(); executed 508 times by 3 tests: prevSectionChanged(); Executed by:
| 508 | ||||||
376 | if (sectChanged)
| 64-556 | ||||||
377 | Q_EMIT sectionChanged(); executed 556 times by 4 tests: sectionChanged(); Executed by:
| 556 | ||||||
378 | if (nextChanged)
| 146-474 | ||||||
379 | Q_EMIT nextSectionChanged(); executed 474 times by 4 tests: nextSectionChanged(); Executed by:
| 474 | ||||||
380 | } executed 620 times by 4 tests: end of block Executed by:
| 620 | ||||||
381 | - | |||||||
382 | void emitAdd() { Q_EMIT add(); } executed 7480 times by 4 tests: end of block Executed by:
| 7480 | ||||||
383 | void emitRemove() { Q_EMIT remove(); } executed 4003 times by 3 tests: end of block Executed by:
| 4003 | ||||||
384 | - | |||||||
385 | Q_SIGNALS: | - | ||||||
386 | void viewChanged(); | - | ||||||
387 | void currentItemChanged(); | - | ||||||
388 | void delayRemoveChanged(); | - | ||||||
389 | - | |||||||
390 | void add(); | - | ||||||
391 | void remove(); | - | ||||||
392 | - | |||||||
393 | void sectionChanged(); | - | ||||||
394 | void prevSectionChanged(); | - | ||||||
395 | void nextSectionChanged(); | - | ||||||
396 | - | |||||||
397 | public: | - | ||||||
398 | QPointer<QQuickItemView> m_view; | - | ||||||
399 | bool m_isCurrent : 1; | - | ||||||
400 | bool m_delayRemove : 1; | - | ||||||
401 | - | |||||||
402 | // current only used by list view | - | ||||||
403 | mutable QString m_section; | - | ||||||
404 | QString m_prevSection; | - | ||||||
405 | QString m_nextSection; | - | ||||||
406 | }; | - | ||||||
407 | - | |||||||
408 | - | |||||||
409 | QT_END_NAMESPACE | - | ||||||
410 | - | |||||||
411 | #endif // QQUICKITEMVIEW_P_H | - | ||||||
412 | - | |||||||
Source code | Switch to Preprocessed file |