Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickitem_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 QQUICKITEM_P_H | - | ||||||||||||
41 | #define QQUICKITEM_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 "qquickitem.h" | - | ||||||||||||
55 | - | |||||||||||||
56 | #include "qquickanchors_p.h" | - | ||||||||||||
57 | #include "qquickanchors_p_p.h" | - | ||||||||||||
58 | #include "qquickitemchangelistener_p.h" | - | ||||||||||||
59 | #include "qquickevents_p_p.h" | - | ||||||||||||
60 | - | |||||||||||||
61 | #include "qquickwindow_p.h" | - | ||||||||||||
62 | - | |||||||||||||
63 | #include <QtQuick/qsgnode.h> | - | ||||||||||||
64 | #include "qquickclipnode_p.h" | - | ||||||||||||
65 | - | |||||||||||||
66 | #include <QtQuick/private/qquickstate_p.h> | - | ||||||||||||
67 | #include <private/qqmlnullablevalue_p.h> | - | ||||||||||||
68 | #include <private/qqmlnotifier_p.h> | - | ||||||||||||
69 | #include <private/qqmlglobal_p.h> | - | ||||||||||||
70 | #include <private/qlazilyallocated_p.h> | - | ||||||||||||
71 | - | |||||||||||||
72 | #include <qqml.h> | - | ||||||||||||
73 | #include <qqmlcontext.h> | - | ||||||||||||
74 | - | |||||||||||||
75 | #include <QtCore/qlist.h> | - | ||||||||||||
76 | #include <QtCore/qdebug.h> | - | ||||||||||||
77 | #include <QtCore/qelapsedtimer.h> | - | ||||||||||||
78 | - | |||||||||||||
79 | #if QT_CONFIG(quick_shadereffect) | - | ||||||||||||
80 | #include <QtQuick/private/qquickshadereffectsource_p.h> | - | ||||||||||||
81 | #endif | - | ||||||||||||
82 | - | |||||||||||||
83 | QT_BEGIN_NAMESPACE | - | ||||||||||||
84 | - | |||||||||||||
85 | class QNetworkReply; | - | ||||||||||||
86 | class QQuickItemKeyFilter; | - | ||||||||||||
87 | class QQuickLayoutMirroringAttached; | - | ||||||||||||
88 | class QQuickEnterKeyAttached; | - | ||||||||||||
89 | class QQuickScreenAttached; | - | ||||||||||||
90 | class QQuickPointerHandler; | - | ||||||||||||
91 | - | |||||||||||||
92 | class QQuickContents : public QQuickItemChangeListener | - | ||||||||||||
93 | { | - | ||||||||||||
94 | public: | - | ||||||||||||
95 | QQuickContents(QQuickItem *item); | - | ||||||||||||
96 | ~QQuickContents() override; | - | ||||||||||||
97 | - | |||||||||||||
98 | QRectF rectF() const { return m_contents; } executed 726 times by 5 tests: return m_contents; Executed by:
| 726 | ||||||||||||
99 | - | |||||||||||||
100 | inline void calcGeometry(QQuickItem *changed = nullptr); | - | ||||||||||||
101 | void complete(); | - | ||||||||||||
102 | - | |||||||||||||
103 | protected: | - | ||||||||||||
104 | void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override; | - | ||||||||||||
105 | void itemDestroyed(QQuickItem *item) override; | - | ||||||||||||
106 | void itemChildAdded(QQuickItem *, QQuickItem *) override; | - | ||||||||||||
107 | void itemChildRemoved(QQuickItem *, QQuickItem *) override; | - | ||||||||||||
108 | //void itemVisibilityChanged(QQuickItem *item) | - | ||||||||||||
109 | - | |||||||||||||
110 | private: | - | ||||||||||||
111 | bool calcHeight(QQuickItem *changed = nullptr); | - | ||||||||||||
112 | bool calcWidth(QQuickItem *changed = nullptr); | - | ||||||||||||
113 | void updateRect(); | - | ||||||||||||
114 | - | |||||||||||||
115 | QQuickItem *m_item; | - | ||||||||||||
116 | QRectF m_contents; | - | ||||||||||||
117 | }; | - | ||||||||||||
118 | - | |||||||||||||
119 | void QQuickContents::calcGeometry(QQuickItem *changed) | - | ||||||||||||
120 | { | - | ||||||||||||
121 | bool wChanged = calcWidth(changed); | - | ||||||||||||
122 | bool hChanged = calcHeight(changed); | - | ||||||||||||
123 | if (wChanged || hChanged)
| 2-158 | ||||||||||||
124 | updateRect(); executed 160 times by 3 tests: updateRect(); Executed by:
| 160 | ||||||||||||
125 | } executed 206 times by 5 tests: end of block Executed by:
| 206 | ||||||||||||
126 | - | |||||||||||||
127 | class QQuickTransformPrivate : public QObjectPrivate | - | ||||||||||||
128 | { | - | ||||||||||||
129 | Q_DECLARE_PUBLIC(QQuickTransform) | - | ||||||||||||
130 | public: | - | ||||||||||||
131 | static QQuickTransformPrivate* get(QQuickTransform *transform) { return transform->d_func(); } executed 852 times by 4 tests: return transform->d_func(); Executed by:
| 852 | ||||||||||||
132 | - | |||||||||||||
133 | QQuickTransformPrivate(); | - | ||||||||||||
134 | - | |||||||||||||
135 | QList<QQuickItem *> items; | - | ||||||||||||
136 | }; | - | ||||||||||||
137 | - | |||||||||||||
138 | #if QT_CONFIG(quick_shadereffect) | - | ||||||||||||
139 | - | |||||||||||||
140 | class QQuickItemLayer : public QObject, public QQuickItemChangeListener | - | ||||||||||||
141 | { | - | ||||||||||||
142 | Q_OBJECT | - | ||||||||||||
143 | Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) | - | ||||||||||||
144 | Q_PROPERTY(QSize textureSize READ size WRITE setSize NOTIFY sizeChanged) | - | ||||||||||||
145 | Q_PROPERTY(QRectF sourceRect READ sourceRect WRITE setSourceRect NOTIFY sourceRectChanged) | - | ||||||||||||
146 | Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged) | - | ||||||||||||
147 | Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) | - | ||||||||||||
148 | Q_PROPERTY(QQuickShaderEffectSource::WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) | - | ||||||||||||
149 | Q_PROPERTY(QQuickShaderEffectSource::Format format READ format WRITE setFormat NOTIFY formatChanged) | - | ||||||||||||
150 | Q_PROPERTY(QByteArray samplerName READ name WRITE setName NOTIFY nameChanged) | - | ||||||||||||
151 | Q_PROPERTY(QQmlComponent *effect READ effect WRITE setEffect NOTIFY effectChanged) | - | ||||||||||||
152 | Q_PROPERTY(QQuickShaderEffectSource::TextureMirroring textureMirroring READ textureMirroring WRITE setTextureMirroring NOTIFY textureMirroringChanged) | - | ||||||||||||
153 | Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged) | - | ||||||||||||
154 | - | |||||||||||||
155 | public: | - | ||||||||||||
156 | QQuickItemLayer(QQuickItem *item); | - | ||||||||||||
157 | ~QQuickItemLayer() override; | - | ||||||||||||
158 | - | |||||||||||||
159 | void classBegin(); | - | ||||||||||||
160 | void componentComplete(); | - | ||||||||||||
161 | - | |||||||||||||
162 | bool enabled() const { return m_enabled; } executed 4 times by 1 test: return m_enabled; Executed by:
| 4 | ||||||||||||
163 | void setEnabled(bool enabled); | - | ||||||||||||
164 | - | |||||||||||||
165 | bool mipmap() const { return m_mipmap; } executed 4 times by 1 test: return m_mipmap; Executed by:
| 4 | ||||||||||||
166 | void setMipmap(bool mipmap); | - | ||||||||||||
167 | - | |||||||||||||
168 | bool smooth() const { return m_smooth; } executed 4 times by 1 test: return m_smooth; Executed by:
| 4 | ||||||||||||
169 | void setSmooth(bool s); | - | ||||||||||||
170 | - | |||||||||||||
171 | QSize size() const { return m_size; } executed 8 times by 1 test: return m_size; Executed by:
| 8 | ||||||||||||
172 | void setSize(const QSize &size); | - | ||||||||||||
173 | - | |||||||||||||
174 | QQuickShaderEffectSource::Format format() const { return m_format; } executed 4 times by 1 test: return m_format; Executed by:
| 4 | ||||||||||||
175 | void setFormat(QQuickShaderEffectSource::Format f); | - | ||||||||||||
176 | - | |||||||||||||
177 | QRectF sourceRect() const { return m_sourceRect; } executed 8 times by 1 test: return m_sourceRect; Executed by:
| 8 | ||||||||||||
178 | void setSourceRect(const QRectF &sourceRect); | - | ||||||||||||
179 | - | |||||||||||||
180 | QQuickShaderEffectSource::WrapMode wrapMode() const { return m_wrapMode; } executed 4 times by 1 test: return m_wrapMode; Executed by:
| 4 | ||||||||||||
181 | void setWrapMode(QQuickShaderEffectSource::WrapMode mode); | - | ||||||||||||
182 | - | |||||||||||||
183 | QByteArray name() const { return m_name; } executed 4 times by 1 test: return m_name; Executed by:
| 4 | ||||||||||||
184 | void setName(const QByteArray &name); | - | ||||||||||||
185 | - | |||||||||||||
186 | QQmlComponent *effect() const { return m_effectComponent; } executed 4 times by 1 test: return m_effectComponent; Executed by:
| 4 | ||||||||||||
187 | void setEffect(QQmlComponent *effect); | - | ||||||||||||
188 | - | |||||||||||||
189 | QQuickShaderEffectSource::TextureMirroring textureMirroring() const { return m_textureMirroring; } executed 4 times by 1 test: return m_textureMirroring; Executed by:
| 4 | ||||||||||||
190 | void setTextureMirroring(QQuickShaderEffectSource::TextureMirroring mirroring); | - | ||||||||||||
191 | - | |||||||||||||
192 | int samples() const { return m_samples; } executed 4 times by 1 test: return m_samples; Executed by:
| 4 | ||||||||||||
193 | void setSamples(int count); | - | ||||||||||||
194 | - | |||||||||||||
195 | QQuickShaderEffectSource *effectSource() const { return m_effectSource; } executed 48 times by 2 tests: return m_effectSource; Executed by:
| 48 | ||||||||||||
196 | - | |||||||||||||
197 | void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override; | - | ||||||||||||
198 | void itemOpacityChanged(QQuickItem *) override; | - | ||||||||||||
199 | void itemParentChanged(QQuickItem *, QQuickItem *) override; | - | ||||||||||||
200 | void itemSiblingOrderChanged(QQuickItem *) override; | - | ||||||||||||
201 | void itemVisibilityChanged(QQuickItem *) override; | - | ||||||||||||
202 | - | |||||||||||||
203 | void updateMatrix(); | - | ||||||||||||
204 | void updateGeometry(); | - | ||||||||||||
205 | void updateOpacity(); | - | ||||||||||||
206 | void updateZ(); | - | ||||||||||||
207 | - | |||||||||||||
208 | Q_SIGNALS: | - | ||||||||||||
209 | void enabledChanged(bool enabled); | - | ||||||||||||
210 | void sizeChanged(const QSize &size); | - | ||||||||||||
211 | void mipmapChanged(bool mipmap); | - | ||||||||||||
212 | void wrapModeChanged(QQuickShaderEffectSource::WrapMode mode); | - | ||||||||||||
213 | void nameChanged(const QByteArray &name); | - | ||||||||||||
214 | void effectChanged(QQmlComponent *component); | - | ||||||||||||
215 | void smoothChanged(bool smooth); | - | ||||||||||||
216 | void formatChanged(QQuickShaderEffectSource::Format format); | - | ||||||||||||
217 | void sourceRectChanged(const QRectF &sourceRect); | - | ||||||||||||
218 | void textureMirroringChanged(QQuickShaderEffectSource::TextureMirroring mirroring); | - | ||||||||||||
219 | void samplesChanged(int count); | - | ||||||||||||
220 | - | |||||||||||||
221 | private: | - | ||||||||||||
222 | friend class QQuickTransformAnimatorJob; | - | ||||||||||||
223 | friend class QQuickOpacityAnimatorJob; | - | ||||||||||||
224 | - | |||||||||||||
225 | void activate(); | - | ||||||||||||
226 | void deactivate(); | - | ||||||||||||
227 | void activateEffect(); | - | ||||||||||||
228 | void deactivateEffect(); | - | ||||||||||||
229 | - | |||||||||||||
230 | QQuickItem *m_item; | - | ||||||||||||
231 | bool m_enabled; | - | ||||||||||||
232 | bool m_mipmap; | - | ||||||||||||
233 | bool m_smooth; | - | ||||||||||||
234 | bool m_componentComplete; | - | ||||||||||||
235 | QQuickShaderEffectSource::WrapMode m_wrapMode; | - | ||||||||||||
236 | QQuickShaderEffectSource::Format m_format; | - | ||||||||||||
237 | QSize m_size; | - | ||||||||||||
238 | QRectF m_sourceRect; | - | ||||||||||||
239 | QByteArray m_name; | - | ||||||||||||
240 | QQmlComponent *m_effectComponent; | - | ||||||||||||
241 | QQuickItem *m_effect; | - | ||||||||||||
242 | QQuickShaderEffectSource *m_effectSource; | - | ||||||||||||
243 | QQuickShaderEffectSource::TextureMirroring m_textureMirroring; | - | ||||||||||||
244 | int m_samples; | - | ||||||||||||
245 | }; | - | ||||||||||||
246 | - | |||||||||||||
247 | #endif | - | ||||||||||||
248 | - | |||||||||||||
249 | class Q_QUICK_PRIVATE_EXPORT QQuickItemPrivate : public QObjectPrivate | - | ||||||||||||
250 | { | - | ||||||||||||
251 | Q_DECLARE_PUBLIC(QQuickItem) | - | ||||||||||||
252 | - | |||||||||||||
253 | public: | - | ||||||||||||
254 | static QQuickItemPrivate* get(QQuickItem *item) { return item->d_func(); } executed 12169416 times by 121 tests: return item->d_func(); Executed by:
| 12169416 | ||||||||||||
255 | static const QQuickItemPrivate* get(const QQuickItem *item) { return item->d_func(); } executed 236852 times by 79 tests: return item->d_func(); Executed by:
| 236852 | ||||||||||||
256 | - | |||||||||||||
257 | QQuickItemPrivate(); | - | ||||||||||||
258 | ~QQuickItemPrivate() override; | - | ||||||||||||
259 | void init(QQuickItem *parent); | - | ||||||||||||
260 | - | |||||||||||||
261 | QQmlListProperty<QObject> data(); | - | ||||||||||||
262 | QQmlListProperty<QObject> resources(); | - | ||||||||||||
263 | QQmlListProperty<QQuickItem> children(); | - | ||||||||||||
264 | QQmlListProperty<QQuickItem> visibleChildren(); | - | ||||||||||||
265 | - | |||||||||||||
266 | QQmlListProperty<QQuickState> states(); | - | ||||||||||||
267 | QQmlListProperty<QQuickTransition> transitions(); | - | ||||||||||||
268 | - | |||||||||||||
269 | QString state() const; | - | ||||||||||||
270 | void setState(const QString &); | - | ||||||||||||
271 | - | |||||||||||||
272 | QQuickAnchorLine left() const; | - | ||||||||||||
273 | QQuickAnchorLine right() const; | - | ||||||||||||
274 | QQuickAnchorLine horizontalCenter() const; | - | ||||||||||||
275 | QQuickAnchorLine top() const; | - | ||||||||||||
276 | QQuickAnchorLine bottom() const; | - | ||||||||||||
277 | QQuickAnchorLine verticalCenter() const; | - | ||||||||||||
278 | QQuickAnchorLine baseline() const; | - | ||||||||||||
279 | - | |||||||||||||
280 | QQuickItemLayer *layer() const; | - | ||||||||||||
281 | - | |||||||||||||
282 | bool hasPointerHandlers() const; | - | ||||||||||||
283 | bool hasHoverHandlers() const; | - | ||||||||||||
284 | - | |||||||||||||
285 | // data property | - | ||||||||||||
286 | static void data_append(QQmlListProperty<QObject> *, QObject *); | - | ||||||||||||
287 | static int data_count(QQmlListProperty<QObject> *); | - | ||||||||||||
288 | static QObject *data_at(QQmlListProperty<QObject> *, int); | - | ||||||||||||
289 | static void data_clear(QQmlListProperty<QObject> *); | - | ||||||||||||
290 | - | |||||||||||||
291 | // resources property | - | ||||||||||||
292 | static QObject *resources_at(QQmlListProperty<QObject> *, int); | - | ||||||||||||
293 | static void resources_append(QQmlListProperty<QObject> *, QObject *); | - | ||||||||||||
294 | static int resources_count(QQmlListProperty<QObject> *); | - | ||||||||||||
295 | static void resources_clear(QQmlListProperty<QObject> *); | - | ||||||||||||
296 | - | |||||||||||||
297 | // children property | - | ||||||||||||
298 | static void children_append(QQmlListProperty<QQuickItem> *, QQuickItem *); | - | ||||||||||||
299 | static int children_count(QQmlListProperty<QQuickItem> *); | - | ||||||||||||
300 | static QQuickItem *children_at(QQmlListProperty<QQuickItem> *, int); | - | ||||||||||||
301 | static void children_clear(QQmlListProperty<QQuickItem> *); | - | ||||||||||||
302 | - | |||||||||||||
303 | // visibleChildren property | - | ||||||||||||
304 | static void visibleChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *o); | - | ||||||||||||
305 | static int visibleChildren_count(QQmlListProperty<QQuickItem> *prop); | - | ||||||||||||
306 | static QQuickItem *visibleChildren_at(QQmlListProperty<QQuickItem> *prop, int index); | - | ||||||||||||
307 | - | |||||||||||||
308 | // transform property | - | ||||||||||||
309 | static int transform_count(QQmlListProperty<QQuickTransform> *list); | - | ||||||||||||
310 | static void transform_append(QQmlListProperty<QQuickTransform> *list, QQuickTransform *); | - | ||||||||||||
311 | static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, int); | - | ||||||||||||
312 | static void transform_clear(QQmlListProperty<QQuickTransform> *list); | - | ||||||||||||
313 | - | |||||||||||||
314 | void _q_resourceObjectDeleted(QObject *); | - | ||||||||||||
315 | quint64 _q_createJSWrapper(QV4::ExecutionEngine *engine); | - | ||||||||||||
316 | - | |||||||||||||
317 | enum ChangeType { | - | ||||||||||||
318 | Geometry = 0x01, | - | ||||||||||||
319 | SiblingOrder = 0x02, | - | ||||||||||||
320 | Visibility = 0x04, | - | ||||||||||||
321 | Opacity = 0x08, | - | ||||||||||||
322 | Destroyed = 0x10, | - | ||||||||||||
323 | Parent = 0x20, | - | ||||||||||||
324 | Children = 0x40, | - | ||||||||||||
325 | Rotation = 0x80, | - | ||||||||||||
326 | ImplicitWidth = 0x100, | - | ||||||||||||
327 | ImplicitHeight = 0x200, | - | ||||||||||||
328 | Enabled = 0x400, | - | ||||||||||||
329 | }; | - | ||||||||||||
330 | - | |||||||||||||
331 | Q_DECLARE_FLAGS(ChangeTypes, ChangeType) | - | ||||||||||||
332 | - | |||||||||||||
333 | struct ChangeListener { | - | ||||||||||||
334 | ChangeListener(QQuickItemChangeListener *l = nullptr, QQuickItemPrivate::ChangeTypes t = nullptr) : listener(l), types(t), gTypes(QQuickGeometryChange::All) {} executed 270500 times by 94 tests: end of block Executed by:
| 270500 | ||||||||||||
335 | ChangeListener(QQuickItemChangeListener *l, QQuickGeometryChange gt) : listener(l), types(Geometry), gTypes(gt) {} executed 13500 times by 76 tests: end of block Executed by:
| 13500 | ||||||||||||
336 | QQuickItemChangeListener *listener; | - | ||||||||||||
337 | QQuickItemPrivate::ChangeTypes types; | - | ||||||||||||
338 | QQuickGeometryChange gTypes; //NOTE: not used for == | - | ||||||||||||
339 | bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; } executed 141562 times by 52 tests: return listener == other.listener && types == other.types; Executed by:
| 141562 | ||||||||||||
340 | }; | - | ||||||||||||
341 | - | |||||||||||||
342 | struct ExtraData { | - | ||||||||||||
343 | ExtraData(); | - | ||||||||||||
344 | - | |||||||||||||
345 | qreal z; | - | ||||||||||||
346 | qreal scale; | - | ||||||||||||
347 | qreal rotation; | - | ||||||||||||
348 | qreal opacity; | - | ||||||||||||
349 | - | |||||||||||||
350 | QQuickContents *contents; | - | ||||||||||||
351 | QQuickScreenAttached *screenAttached; | - | ||||||||||||
352 | QQuickLayoutMirroringAttached* layoutDirectionAttached; | - | ||||||||||||
353 | QQuickEnterKeyAttached *enterKeyAttached; | - | ||||||||||||
354 | QQuickItemKeyFilter *keyHandler; | - | ||||||||||||
355 | QVector<QQuickPointerHandler *> pointerHandlers; | - | ||||||||||||
356 | #if QT_CONFIG(quick_shadereffect) | - | ||||||||||||
357 | mutable QQuickItemLayer *layer; | - | ||||||||||||
358 | #endif | - | ||||||||||||
359 | #if QT_CONFIG(cursor) | - | ||||||||||||
360 | QCursor cursor; | - | ||||||||||||
361 | #endif | - | ||||||||||||
362 | QPointF userTransformOriginPoint; | - | ||||||||||||
363 | - | |||||||||||||
364 | // these do not include child items | - | ||||||||||||
365 | int effectRefCount; | - | ||||||||||||
366 | int hideRefCount; | - | ||||||||||||
367 | // updated recursively for child items as well | - | ||||||||||||
368 | int recursiveEffectRefCount; | - | ||||||||||||
369 | - | |||||||||||||
370 | QSGOpacityNode *opacityNode; | - | ||||||||||||
371 | QQuickDefaultClipNode *clipNode; | - | ||||||||||||
372 | QSGRootNode *rootNode; | - | ||||||||||||
373 | - | |||||||||||||
374 | // Mask contains() method | - | ||||||||||||
375 | QMetaMethod maskContains; | - | ||||||||||||
376 | - | |||||||||||||
377 | QObjectList resourcesList; | - | ||||||||||||
378 | - | |||||||||||||
379 | // Although acceptedMouseButtons is inside ExtraData, we actually store | - | ||||||||||||
380 | // the LeftButton flag in the extra.flag() bit. This is because it is | - | ||||||||||||
381 | // extremely common to set acceptedMouseButtons to LeftButton, but very | - | ||||||||||||
382 | // rare to use any of the other buttons. | - | ||||||||||||
383 | Qt::MouseButtons acceptedMouseButtons; | - | ||||||||||||
384 | - | |||||||||||||
385 | QQuickItem::TransformOrigin origin:5; | - | ||||||||||||
386 | uint transparentForPositioner : 1; | - | ||||||||||||
387 | - | |||||||||||||
388 | // 26 bits padding | - | ||||||||||||
389 | }; | - | ||||||||||||
390 | QLazilyAllocated<ExtraData> extra; | - | ||||||||||||
391 | // Contains mask | - | ||||||||||||
392 | QPointer<QObject> mask; | - | ||||||||||||
393 | // If the mask is an Item, inform it that it's being used as a mask (true) or is no longer being used (false) | - | ||||||||||||
394 | virtual void registerAsContainmentMask(QQuickItem * /* maskedItem */, bool /* set */) { } | - | ||||||||||||
395 | - | |||||||||||||
396 | QQuickAnchors *anchors() const; | - | ||||||||||||
397 | mutable QQuickAnchors *_anchors; | - | ||||||||||||
398 | - | |||||||||||||
399 | inline Qt::MouseButtons acceptedMouseButtons() const; | - | ||||||||||||
400 | - | |||||||||||||
401 | QVector<QQuickItemPrivate::ChangeListener> changeListeners; | - | ||||||||||||
402 | - | |||||||||||||
403 | void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types); | - | ||||||||||||
404 | void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types); | - | ||||||||||||
405 | void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types); | - | ||||||||||||
406 | void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types); | - | ||||||||||||
407 | - | |||||||||||||
408 | QQuickStateGroup *_states(); | - | ||||||||||||
409 | QQuickStateGroup *_stateGroup; | - | ||||||||||||
410 | - | |||||||||||||
411 | inline QQuickItem::TransformOrigin origin() const; | - | ||||||||||||
412 | - | |||||||||||||
413 | // Bit 0 | - | ||||||||||||
414 | quint32 flags:5; | - | ||||||||||||
415 | bool widthValid:1; | - | ||||||||||||
416 | bool heightValid:1; | - | ||||||||||||
417 | bool componentComplete:1; | - | ||||||||||||
418 | bool keepMouse:1; | - | ||||||||||||
419 | bool keepTouch:1; | - | ||||||||||||
420 | bool hoverEnabled:1; | - | ||||||||||||
421 | bool smooth:1; | - | ||||||||||||
422 | bool antialiasing:1; | - | ||||||||||||
423 | bool focus:1; | - | ||||||||||||
424 | bool activeFocus:1; | - | ||||||||||||
425 | bool notifiedFocus:1; | - | ||||||||||||
426 | // Bit 16 | - | ||||||||||||
427 | bool notifiedActiveFocus:1; | - | ||||||||||||
428 | bool filtersChildMouseEvents:1; | - | ||||||||||||
429 | bool explicitVisible:1; | - | ||||||||||||
430 | bool effectiveVisible:1; | - | ||||||||||||
431 | bool explicitEnable:1; | - | ||||||||||||
432 | bool effectiveEnable:1; | - | ||||||||||||
433 | bool polishScheduled:1; | - | ||||||||||||
434 | bool inheritedLayoutMirror:1; | - | ||||||||||||
435 | bool effectiveLayoutMirror:1; | - | ||||||||||||
436 | bool isMirrorImplicit:1; | - | ||||||||||||
437 | bool inheritMirrorFromParent:1; | - | ||||||||||||
438 | bool inheritMirrorFromItem:1; | - | ||||||||||||
439 | bool isAccessible:1; | - | ||||||||||||
440 | bool culled:1; | - | ||||||||||||
441 | bool hasCursor:1; | - | ||||||||||||
442 | bool subtreeCursorEnabled:1; | - | ||||||||||||
443 | // Bit 32 | - | ||||||||||||
444 | bool subtreeHoverEnabled:1; | - | ||||||||||||
445 | bool activeFocusOnTab:1; | - | ||||||||||||
446 | bool implicitAntialiasing:1; | - | ||||||||||||
447 | bool antialiasingValid:1; | - | ||||||||||||
448 | // isTabFence: When true, the item acts as a fence within the tab focus chain. | - | ||||||||||||
449 | // This means that the item and its children will be skipped from the tab focus | - | ||||||||||||
450 | // chain when navigating from its parent or any of its siblings. Similarly, | - | ||||||||||||
451 | // when any of the item's descendants gets focus, the item constrains the tab | - | ||||||||||||
452 | // focus chain and prevents tabbing outside. | - | ||||||||||||
453 | bool isTabFence:1; | - | ||||||||||||
454 | bool replayingPressEvent:1; | - | ||||||||||||
455 | bool touchEnabled:1; | - | ||||||||||||
456 | - | |||||||||||||
457 | enum DirtyType { | - | ||||||||||||
458 | TransformOrigin = 0x00000001, | - | ||||||||||||
459 | Transform = 0x00000002, | - | ||||||||||||
460 | BasicTransform = 0x00000004, | - | ||||||||||||
461 | Position = 0x00000008, | - | ||||||||||||
462 | Size = 0x00000010, | - | ||||||||||||
463 | - | |||||||||||||
464 | ZValue = 0x00000020, | - | ||||||||||||
465 | Content = 0x00000040, | - | ||||||||||||
466 | Smooth = 0x00000080, | - | ||||||||||||
467 | OpacityValue = 0x00000100, | - | ||||||||||||
468 | ChildrenChanged = 0x00000200, | - | ||||||||||||
469 | ChildrenStackingChanged = 0x00000400, | - | ||||||||||||
470 | ParentChanged = 0x00000800, | - | ||||||||||||
471 | - | |||||||||||||
472 | Clip = 0x00001000, | - | ||||||||||||
473 | Window = 0x00002000, | - | ||||||||||||
474 | - | |||||||||||||
475 | EffectReference = 0x00008000, | - | ||||||||||||
476 | Visible = 0x00010000, | - | ||||||||||||
477 | HideReference = 0x00020000, | - | ||||||||||||
478 | Antialiasing = 0x00040000, | - | ||||||||||||
479 | // When you add an attribute here, don't forget to update | - | ||||||||||||
480 | // dirtyToString() | - | ||||||||||||
481 | - | |||||||||||||
482 | TransformUpdateMask = TransformOrigin | Transform | BasicTransform | Position | | - | ||||||||||||
483 | Window, | - | ||||||||||||
484 | ComplexTransformUpdateMask = Transform | Window, | - | ||||||||||||
485 | ContentUpdateMask = Size | Content | Smooth | Window | Antialiasing, | - | ||||||||||||
486 | ChildrenUpdateMask = ChildrenChanged | ChildrenStackingChanged | EffectReference | Window | - | ||||||||||||
487 | }; | - | ||||||||||||
488 | - | |||||||||||||
489 | quint32 dirtyAttributes; | - | ||||||||||||
490 | QString dirtyToString() const; | - | ||||||||||||
491 | void dirty(DirtyType); | - | ||||||||||||
492 | void addToDirtyList(); | - | ||||||||||||
493 | void removeFromDirtyList(); | - | ||||||||||||
494 | QQuickItem *nextDirtyItem; | - | ||||||||||||
495 | QQuickItem**prevDirtyItem; | - | ||||||||||||
496 | - | |||||||||||||
497 | void setCulled(bool); | - | ||||||||||||
498 | - | |||||||||||||
499 | QQuickWindow *window; | - | ||||||||||||
500 | int windowRefCount; | - | ||||||||||||
501 | inline QSGContext *sceneGraphContext() const; | - | ||||||||||||
502 | inline QSGRenderContext *sceneGraphRenderContext() const; | - | ||||||||||||
503 | - | |||||||||||||
504 | QQuickItem *parentItem; | - | ||||||||||||
505 | - | |||||||||||||
506 | QList<QQuickItem *> childItems; | - | ||||||||||||
507 | mutable QList<QQuickItem *> *sortedChildItems; | - | ||||||||||||
508 | QList<QQuickItem *> paintOrderChildItems() const; | - | ||||||||||||
509 | void addChild(QQuickItem *); | - | ||||||||||||
510 | void removeChild(QQuickItem *); | - | ||||||||||||
511 | void siblingOrderChanged(); | - | ||||||||||||
512 | - | |||||||||||||
513 | inline void markSortedChildrenDirty(QQuickItem *child); | - | ||||||||||||
514 | - | |||||||||||||
515 | void refWindow(QQuickWindow *); | - | ||||||||||||
516 | void derefWindow(); | - | ||||||||||||
517 | - | |||||||||||||
518 | QQuickItem *subFocusItem; | - | ||||||||||||
519 | void updateSubFocusItem(QQuickItem *scope, bool focus); | - | ||||||||||||
520 | - | |||||||||||||
521 | QTransform windowToItemTransform() const; | - | ||||||||||||
522 | QTransform itemToWindowTransform() const; | - | ||||||||||||
523 | void itemToParentTransform(QTransform &) const; | - | ||||||||||||
524 | QTransform globalToWindowTransform() const; | - | ||||||||||||
525 | QTransform windowToGlobalTransform() const; | - | ||||||||||||
526 | - | |||||||||||||
527 | static bool focusNextPrev(QQuickItem *item, bool forward); | - | ||||||||||||
528 | static QQuickItem *nextTabChildItem(const QQuickItem *item, int start); | - | ||||||||||||
529 | static QQuickItem *prevTabChildItem(const QQuickItem *item, int start); | - | ||||||||||||
530 | static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item, bool forward); | - | ||||||||||||
531 | - | |||||||||||||
532 | static bool canAcceptTabFocus(QQuickItem *item); | - | ||||||||||||
533 | - | |||||||||||||
534 | qreal x; | - | ||||||||||||
535 | qreal y; | - | ||||||||||||
536 | qreal width; | - | ||||||||||||
537 | qreal height; | - | ||||||||||||
538 | qreal implicitWidth; | - | ||||||||||||
539 | qreal implicitHeight; | - | ||||||||||||
540 | - | |||||||||||||
541 | qreal baselineOffset; | - | ||||||||||||
542 | - | |||||||||||||
543 | QList<QQuickTransform *> transforms; | - | ||||||||||||
544 | - | |||||||||||||
545 | inline qreal z() const { return extra.isAllocated()?extra->z:0; } executed 2232853 times by 107 tests: return extra.isAllocated()?extra->z:0; Executed by:
| 2232853 | ||||||||||||
546 | inline qreal scale() const { return extra.isAllocated()?extra->scale:1; } executed 1365066 times by 89 tests: return extra.isAllocated()?extra->scale:1; Executed by:
| 1365066 | ||||||||||||
547 | inline qreal rotation() const { return extra.isAllocated()?extra->rotation:0; } executed 1354598 times by 90 tests: return extra.isAllocated()?extra->rotation:0; Executed by:
| 1354598 | ||||||||||||
548 | inline qreal opacity() const { return extra.isAllocated()?extra->opacity:1; } executed 396975 times by 85 tests: return extra.isAllocated()?extra->opacity:1; Executed by:
| 396975 | ||||||||||||
549 | - | |||||||||||||
550 | void setAccessible(); | - | ||||||||||||
551 | - | |||||||||||||
552 | virtual qreal getImplicitWidth() const; | - | ||||||||||||
553 | virtual qreal getImplicitHeight() const; | - | ||||||||||||
554 | virtual void implicitWidthChanged(); | - | ||||||||||||
555 | virtual void implicitHeightChanged(); | - | ||||||||||||
556 | - | |||||||||||||
557 | #if QT_CONFIG(accessibility) | - | ||||||||||||
558 | virtual QAccessible::Role accessibleRole() const; | - | ||||||||||||
559 | #endif | - | ||||||||||||
560 | - | |||||||||||||
561 | void setImplicitAntialiasing(bool antialiasing); | - | ||||||||||||
562 | - | |||||||||||||
563 | void resolveLayoutMirror(); | - | ||||||||||||
564 | void setImplicitLayoutMirror(bool mirror, bool inherit); | - | ||||||||||||
565 | void setLayoutMirror(bool mirror); | - | ||||||||||||
566 | bool isMirrored() const { | - | ||||||||||||
567 | return effectiveLayoutMirror; never executed: return effectiveLayoutMirror; | 0 | ||||||||||||
568 | } | - | ||||||||||||
569 | - | |||||||||||||
570 | void emitChildrenRectChanged(const QRectF &rect) { | - | ||||||||||||
571 | Q_Q(QQuickItem); | - | ||||||||||||
572 | Q_EMIT q->childrenRectChanged(rect); | - | ||||||||||||
573 | } executed 202 times by 3 tests: end of block Executed by:
| 202 | ||||||||||||
574 | - | |||||||||||||
575 | QPointF computeTransformOrigin() const; | - | ||||||||||||
576 | virtual void transformChanged(); | - | ||||||||||||
577 | - | |||||||||||||
578 | void deliverKeyEvent(QKeyEvent *); | - | ||||||||||||
579 | bool filterKeyEvent(QKeyEvent *, bool post); | - | ||||||||||||
580 | #if QT_CONFIG(im) | - | ||||||||||||
581 | void deliverInputMethodEvent(QInputMethodEvent *); | - | ||||||||||||
582 | #endif | - | ||||||||||||
583 | void deliverShortcutOverrideEvent(QKeyEvent *); | - | ||||||||||||
584 | - | |||||||||||||
585 | bool anyPointerHandlerWants(QQuickEventPoint *point) const; | - | ||||||||||||
586 | virtual bool handlePointerEvent(QQuickPointerEvent *, bool avoidExclusiveGrabber = false); | - | ||||||||||||
587 | - | |||||||||||||
588 | virtual void setVisible(bool visible); | - | ||||||||||||
589 | - | |||||||||||||
590 | bool isTransparentForPositioner() const; | - | ||||||||||||
591 | void setTransparentForPositioner(bool trans); | - | ||||||||||||
592 | - | |||||||||||||
593 | bool calcEffectiveVisible() const; | - | ||||||||||||
594 | bool setEffectiveVisibleRecur(bool); | - | ||||||||||||
595 | bool calcEffectiveEnable() const; | - | ||||||||||||
596 | void setEffectiveEnableRecur(QQuickItem *scope, bool); | - | ||||||||||||
597 | - | |||||||||||||
598 | - | |||||||||||||
599 | inline QSGTransformNode *itemNode(); | - | ||||||||||||
600 | inline QSGNode *childContainerNode(); | - | ||||||||||||
601 | - | |||||||||||||
602 | /* | - | ||||||||||||
603 | QSGNode order is: | - | ||||||||||||
604 | - itemNode | - | ||||||||||||
605 | - (opacityNode) | - | ||||||||||||
606 | - (clipNode) | - | ||||||||||||
607 | - (rootNode) (shader effect source's root node) | - | ||||||||||||
608 | */ | - | ||||||||||||
609 | - | |||||||||||||
610 | QSGOpacityNode *opacityNode() const { return extra.isAllocated()?extra->opacityNode:nullptr; } executed 1691739 times by 77 tests: return extra.isAllocated()?extra->opacityNode:nullptr; Executed by:
| 1691739 | ||||||||||||
611 | QQuickDefaultClipNode *clipNode() const { return extra.isAllocated()?extra->clipNode:nullptr; } executed 1956224 times by 77 tests: return extra.isAllocated()?extra->clipNode:nullptr; Executed by:
| 1956224 | ||||||||||||
612 | QSGRootNode *rootNode() const { return extra.isAllocated()?extra->rootNode:nullptr; } executed 1587156 times by 77 tests: return extra.isAllocated()?extra->rootNode:nullptr; Executed by:
| 1587156 | ||||||||||||
613 | - | |||||||||||||
614 | QSGTransformNode *itemNodeInstance; | - | ||||||||||||
615 | QSGNode *paintNode; | - | ||||||||||||
616 | - | |||||||||||||
617 | virtual QSGTransformNode *createTransformNode(); | - | ||||||||||||
618 | - | |||||||||||||
619 | // A reference from an effect item means that this item is used by the effect, so | - | ||||||||||||
620 | // it should insert a root node. | - | ||||||||||||
621 | void refFromEffectItem(bool hide); | - | ||||||||||||
622 | void recursiveRefFromEffectItem(int refs); | - | ||||||||||||
623 | void derefFromEffectItem(bool unhide); | - | ||||||||||||
624 | - | |||||||||||||
625 | void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &); | - | ||||||||||||
626 | - | |||||||||||||
627 | virtual void mirrorChange() {} | - | ||||||||||||
628 | - | |||||||||||||
629 | void setHasCursorInChild(bool hasCursor); | - | ||||||||||||
630 | void setHasHoverInChild(bool hasHover); | - | ||||||||||||
631 | - | |||||||||||||
632 | virtual void updatePolish() { } | - | ||||||||||||
633 | }; | - | ||||||||||||
634 | - | |||||||||||||
635 | /* | - | ||||||||||||
636 | Key filters can be installed on a QQuickItem, but not removed. Currently they | - | ||||||||||||
637 | are only used by attached objects (which are only destroyed on Item | - | ||||||||||||
638 | destruction), so this isn't a problem. If in future this becomes any form | - | ||||||||||||
639 | of public API, they will have to support removal too. | - | ||||||||||||
640 | */ | - | ||||||||||||
641 | class QQuickItemKeyFilter | - | ||||||||||||
642 | { | - | ||||||||||||
643 | public: | - | ||||||||||||
644 | QQuickItemKeyFilter(QQuickItem * = nullptr); | - | ||||||||||||
645 | virtual ~QQuickItemKeyFilter(); | - | ||||||||||||
646 | - | |||||||||||||
647 | virtual void keyPressed(QKeyEvent *event, bool post); | - | ||||||||||||
648 | virtual void keyReleased(QKeyEvent *event, bool post); | - | ||||||||||||
649 | #if QT_CONFIG(im) | - | ||||||||||||
650 | virtual void inputMethodEvent(QInputMethodEvent *event, bool post); | - | ||||||||||||
651 | virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; | - | ||||||||||||
652 | #endif | - | ||||||||||||
653 | virtual void shortcutOverride(QKeyEvent *event); | - | ||||||||||||
654 | virtual void componentComplete(); | - | ||||||||||||
655 | - | |||||||||||||
656 | bool m_processPost; | - | ||||||||||||
657 | - | |||||||||||||
658 | private: | - | ||||||||||||
659 | QQuickItemKeyFilter *m_next; | - | ||||||||||||
660 | }; | - | ||||||||||||
661 | - | |||||||||||||
662 | class QQuickKeyNavigationAttachedPrivate : public QObjectPrivate | - | ||||||||||||
663 | { | - | ||||||||||||
664 | public: | - | ||||||||||||
665 | QQuickKeyNavigationAttachedPrivate() | - | ||||||||||||
666 | : leftSet(false), rightSet(false), upSet(false), downSet(false), | - | ||||||||||||
667 | tabSet(false), backtabSet(false) {} executed 144 times by 5 tests: end of block Executed by:
| 144 | ||||||||||||
668 | - | |||||||||||||
669 | QQuickItem *left = nullptr; | - | ||||||||||||
670 | QQuickItem *right = nullptr; | - | ||||||||||||
671 | QQuickItem *up = nullptr; | - | ||||||||||||
672 | QQuickItem *down = nullptr; | - | ||||||||||||
673 | QQuickItem *tab = nullptr; | - | ||||||||||||
674 | QQuickItem *backtab = nullptr; | - | ||||||||||||
675 | bool leftSet : 1; | - | ||||||||||||
676 | bool rightSet : 1; | - | ||||||||||||
677 | bool upSet : 1; | - | ||||||||||||
678 | bool downSet : 1; | - | ||||||||||||
679 | bool tabSet : 1; | - | ||||||||||||
680 | bool backtabSet : 1; | - | ||||||||||||
681 | }; | - | ||||||||||||
682 | - | |||||||||||||
683 | class Q_QUICK_PRIVATE_EXPORT QQuickKeyNavigationAttached : public QObject, public QQuickItemKeyFilter | - | ||||||||||||
684 | { | - | ||||||||||||
685 | Q_OBJECT | - | ||||||||||||
686 | Q_DECLARE_PRIVATE(QQuickKeyNavigationAttached) executed 1264 times by 5 tests: return reinterpret_cast<QQuickKeyNavigationAttachedPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 136 times by 1 test: return reinterpret_cast<const QQuickKeyNavigationAttachedPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 136-1264 | ||||||||||||
687 | - | |||||||||||||
688 | Q_PROPERTY(QQuickItem *left READ left WRITE setLeft NOTIFY leftChanged) | - | ||||||||||||
689 | Q_PROPERTY(QQuickItem *right READ right WRITE setRight NOTIFY rightChanged) | - | ||||||||||||
690 | Q_PROPERTY(QQuickItem *up READ up WRITE setUp NOTIFY upChanged) | - | ||||||||||||
691 | Q_PROPERTY(QQuickItem *down READ down WRITE setDown NOTIFY downChanged) | - | ||||||||||||
692 | Q_PROPERTY(QQuickItem *tab READ tab WRITE setTab NOTIFY tabChanged) | - | ||||||||||||
693 | Q_PROPERTY(QQuickItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged) | - | ||||||||||||
694 | Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) | - | ||||||||||||
695 | - | |||||||||||||
696 | public: | - | ||||||||||||
697 | QQuickKeyNavigationAttached(QObject * = nullptr); | - | ||||||||||||
698 | - | |||||||||||||
699 | QQuickItem *left() const; | - | ||||||||||||
700 | void setLeft(QQuickItem *); | - | ||||||||||||
701 | QQuickItem *right() const; | - | ||||||||||||
702 | void setRight(QQuickItem *); | - | ||||||||||||
703 | QQuickItem *up() const; | - | ||||||||||||
704 | void setUp(QQuickItem *); | - | ||||||||||||
705 | QQuickItem *down() const; | - | ||||||||||||
706 | void setDown(QQuickItem *); | - | ||||||||||||
707 | QQuickItem *tab() const; | - | ||||||||||||
708 | void setTab(QQuickItem *); | - | ||||||||||||
709 | QQuickItem *backtab() const; | - | ||||||||||||
710 | void setBacktab(QQuickItem *); | - | ||||||||||||
711 | - | |||||||||||||
712 | enum Priority { BeforeItem, AfterItem }; | - | ||||||||||||
713 | Q_ENUM(Priority) | - | ||||||||||||
714 | Priority priority() const; | - | ||||||||||||
715 | void setPriority(Priority); | - | ||||||||||||
716 | - | |||||||||||||
717 | static QQuickKeyNavigationAttached *qmlAttachedProperties(QObject *); | - | ||||||||||||
718 | - | |||||||||||||
719 | Q_SIGNALS: | - | ||||||||||||
720 | void leftChanged(); | - | ||||||||||||
721 | void rightChanged(); | - | ||||||||||||
722 | void upChanged(); | - | ||||||||||||
723 | void downChanged(); | - | ||||||||||||
724 | void tabChanged(); | - | ||||||||||||
725 | void backtabChanged(); | - | ||||||||||||
726 | void priorityChanged(); | - | ||||||||||||
727 | - | |||||||||||||
728 | private: | - | ||||||||||||
729 | void keyPressed(QKeyEvent *event, bool post) override; | - | ||||||||||||
730 | void keyReleased(QKeyEvent *event, bool post) override; | - | ||||||||||||
731 | void setFocusNavigation(QQuickItem *currentItem, const char *dir, | - | ||||||||||||
732 | Qt::FocusReason reason = Qt::OtherFocusReason); | - | ||||||||||||
733 | }; | - | ||||||||||||
734 | - | |||||||||||||
735 | class QQuickLayoutMirroringAttached : public QObject | - | ||||||||||||
736 | { | - | ||||||||||||
737 | Q_OBJECT | - | ||||||||||||
738 | Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged) | - | ||||||||||||
739 | Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged) | - | ||||||||||||
740 | - | |||||||||||||
741 | public: | - | ||||||||||||
742 | explicit QQuickLayoutMirroringAttached(QObject *parent = nullptr); | - | ||||||||||||
743 | - | |||||||||||||
744 | bool enabled() const; | - | ||||||||||||
745 | void setEnabled(bool); | - | ||||||||||||
746 | void resetEnabled(); | - | ||||||||||||
747 | - | |||||||||||||
748 | bool childrenInherit() const; | - | ||||||||||||
749 | void setChildrenInherit(bool); | - | ||||||||||||
750 | - | |||||||||||||
751 | static QQuickLayoutMirroringAttached *qmlAttachedProperties(QObject *); | - | ||||||||||||
752 | Q_SIGNALS: | - | ||||||||||||
753 | void enabledChanged(); | - | ||||||||||||
754 | void childrenInheritChanged(); | - | ||||||||||||
755 | private: | - | ||||||||||||
756 | friend class QQuickItemPrivate; | - | ||||||||||||
757 | QQuickItemPrivate *itemPrivate; | - | ||||||||||||
758 | }; | - | ||||||||||||
759 | - | |||||||||||||
760 | class QQuickEnterKeyAttached : public QObject | - | ||||||||||||
761 | { | - | ||||||||||||
762 | Q_OBJECT | - | ||||||||||||
763 | Q_PROPERTY(Qt::EnterKeyType type READ type WRITE setType NOTIFY typeChanged) | - | ||||||||||||
764 | - | |||||||||||||
765 | public: | - | ||||||||||||
766 | explicit QQuickEnterKeyAttached(QObject *parent = nullptr); | - | ||||||||||||
767 | - | |||||||||||||
768 | Qt::EnterKeyType type() const; | - | ||||||||||||
769 | void setType(Qt::EnterKeyType type); | - | ||||||||||||
770 | - | |||||||||||||
771 | static QQuickEnterKeyAttached *qmlAttachedProperties(QObject *); | - | ||||||||||||
772 | Q_SIGNALS: | - | ||||||||||||
773 | void typeChanged(); | - | ||||||||||||
774 | private: | - | ||||||||||||
775 | friend class QQuickItemPrivate; | - | ||||||||||||
776 | QQuickItemPrivate *itemPrivate; | - | ||||||||||||
777 | - | |||||||||||||
778 | Qt::EnterKeyType keyType; | - | ||||||||||||
779 | }; | - | ||||||||||||
780 | - | |||||||||||||
781 | class QQuickKeysAttachedPrivate : public QObjectPrivate | - | ||||||||||||
782 | { | - | ||||||||||||
783 | public: | - | ||||||||||||
784 | QQuickKeysAttachedPrivate() | - | ||||||||||||
785 | : inPress(false), inRelease(false), inIM(false), enabled(true) | - | ||||||||||||
786 | {} executed 320 times by 8 tests: end of block Executed by:
| 320 | ||||||||||||
787 | - | |||||||||||||
788 | //loop detection | - | ||||||||||||
789 | bool inPress:1; | - | ||||||||||||
790 | bool inRelease:1; | - | ||||||||||||
791 | bool inIM:1; | - | ||||||||||||
792 | - | |||||||||||||
793 | bool enabled : 1; | - | ||||||||||||
794 | - | |||||||||||||
795 | QQuickItem *imeItem = nullptr; | - | ||||||||||||
796 | QList<QQuickItem *> targets; | - | ||||||||||||
797 | QQuickItem *item = nullptr; | - | ||||||||||||
798 | QQuickKeyEvent theKeyEvent; | - | ||||||||||||
799 | }; | - | ||||||||||||
800 | - | |||||||||||||
801 | class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter | - | ||||||||||||
802 | { | - | ||||||||||||
803 | Q_OBJECT | - | ||||||||||||
804 | Q_DECLARE_PRIVATE(QQuickKeysAttached) executed 934 times by 8 tests: return reinterpret_cast<QQuickKeysAttachedPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 100 times by 3 tests: return reinterpret_cast<const QQuickKeysAttachedPrivate *>(qGetPtrHelper(d_ptr)); Executed by:
| 100-934 | ||||||||||||
805 | - | |||||||||||||
806 | Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) | - | ||||||||||||
807 | Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo) | - | ||||||||||||
808 | Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) | - | ||||||||||||
809 | - | |||||||||||||
810 | public: | - | ||||||||||||
811 | QQuickKeysAttached(QObject *parent=nullptr); | - | ||||||||||||
812 | ~QQuickKeysAttached() override; | - | ||||||||||||
813 | - | |||||||||||||
814 | bool enabled() const { Q_D(const QQuickKeysAttached); return d->enabled; } executed 6 times by 1 test: return d->enabled; Executed by:
| 6 | ||||||||||||
815 | void setEnabled(bool enabled) { | - | ||||||||||||
816 | Q_D(QQuickKeysAttached); | - | ||||||||||||
817 | if (enabled != d->enabled) {
| 2-4 | ||||||||||||
818 | d->enabled = enabled; | - | ||||||||||||
819 | Q_EMIT enabledChanged(); | - | ||||||||||||
820 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||
821 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
822 | - | |||||||||||||
823 | enum Priority { BeforeItem, AfterItem}; | - | ||||||||||||
824 | Q_ENUM(Priority) | - | ||||||||||||
825 | Priority priority() const; | - | ||||||||||||
826 | void setPriority(Priority); | - | ||||||||||||
827 | - | |||||||||||||
828 | QQmlListProperty<QQuickItem> forwardTo() { | - | ||||||||||||
829 | Q_D(QQuickKeysAttached); | - | ||||||||||||
830 | return QQmlListProperty<QQuickItem>(this, d->targets); executed 16 times by 1 test: return QQmlListProperty<QQuickItem>(this, d->targets); Executed by:
| 16 | ||||||||||||
831 | } | - | ||||||||||||
832 | - | |||||||||||||
833 | void componentComplete() override; | - | ||||||||||||
834 | - | |||||||||||||
835 | static QQuickKeysAttached *qmlAttachedProperties(QObject *); | - | ||||||||||||
836 | - | |||||||||||||
837 | Q_SIGNALS: | - | ||||||||||||
838 | void enabledChanged(); | - | ||||||||||||
839 | void priorityChanged(); | - | ||||||||||||
840 | void pressed(QQuickKeyEvent *event); | - | ||||||||||||
841 | void released(QQuickKeyEvent *event); | - | ||||||||||||
842 | void shortcutOverride(QQuickKeyEvent *event); | - | ||||||||||||
843 | void digit0Pressed(QQuickKeyEvent *event); | - | ||||||||||||
844 | void digit1Pressed(QQuickKeyEvent *event); | - | ||||||||||||
845 | void digit2Pressed(QQuickKeyEvent *event); | - | ||||||||||||
846 | void digit3Pressed(QQuickKeyEvent *event); | - | ||||||||||||
847 | void digit4Pressed(QQuickKeyEvent *event); | - | ||||||||||||
848 | void digit5Pressed(QQuickKeyEvent *event); | - | ||||||||||||
849 | void digit6Pressed(QQuickKeyEvent *event); | - | ||||||||||||
850 | void digit7Pressed(QQuickKeyEvent *event); | - | ||||||||||||
851 | void digit8Pressed(QQuickKeyEvent *event); | - | ||||||||||||
852 | void digit9Pressed(QQuickKeyEvent *event); | - | ||||||||||||
853 | - | |||||||||||||
854 | void leftPressed(QQuickKeyEvent *event); | - | ||||||||||||
855 | void rightPressed(QQuickKeyEvent *event); | - | ||||||||||||
856 | void upPressed(QQuickKeyEvent *event); | - | ||||||||||||
857 | void downPressed(QQuickKeyEvent *event); | - | ||||||||||||
858 | void tabPressed(QQuickKeyEvent *event); | - | ||||||||||||
859 | void backtabPressed(QQuickKeyEvent *event); | - | ||||||||||||
860 | - | |||||||||||||
861 | void asteriskPressed(QQuickKeyEvent *event); | - | ||||||||||||
862 | void numberSignPressed(QQuickKeyEvent *event); | - | ||||||||||||
863 | void escapePressed(QQuickKeyEvent *event); | - | ||||||||||||
864 | void returnPressed(QQuickKeyEvent *event); | - | ||||||||||||
865 | void enterPressed(QQuickKeyEvent *event); | - | ||||||||||||
866 | void deletePressed(QQuickKeyEvent *event); | - | ||||||||||||
867 | void spacePressed(QQuickKeyEvent *event); | - | ||||||||||||
868 | void backPressed(QQuickKeyEvent *event); | - | ||||||||||||
869 | void cancelPressed(QQuickKeyEvent *event); | - | ||||||||||||
870 | void selectPressed(QQuickKeyEvent *event); | - | ||||||||||||
871 | void yesPressed(QQuickKeyEvent *event); | - | ||||||||||||
872 | void noPressed(QQuickKeyEvent *event); | - | ||||||||||||
873 | void context1Pressed(QQuickKeyEvent *event); | - | ||||||||||||
874 | void context2Pressed(QQuickKeyEvent *event); | - | ||||||||||||
875 | void context3Pressed(QQuickKeyEvent *event); | - | ||||||||||||
876 | void context4Pressed(QQuickKeyEvent *event); | - | ||||||||||||
877 | void callPressed(QQuickKeyEvent *event); | - | ||||||||||||
878 | void hangupPressed(QQuickKeyEvent *event); | - | ||||||||||||
879 | void flipPressed(QQuickKeyEvent *event); | - | ||||||||||||
880 | void menuPressed(QQuickKeyEvent *event); | - | ||||||||||||
881 | void volumeUpPressed(QQuickKeyEvent *event); | - | ||||||||||||
882 | void volumeDownPressed(QQuickKeyEvent *event); | - | ||||||||||||
883 | - | |||||||||||||
884 | private: | - | ||||||||||||
885 | void keyPressed(QKeyEvent *event, bool post) override; | - | ||||||||||||
886 | void keyReleased(QKeyEvent *event, bool post) override; | - | ||||||||||||
887 | #if QT_CONFIG(im) | - | ||||||||||||
888 | void inputMethodEvent(QInputMethodEvent *, bool post) override; | - | ||||||||||||
889 | QVariant inputMethodQuery(Qt::InputMethodQuery query) const override; | - | ||||||||||||
890 | #endif | - | ||||||||||||
891 | void shortcutOverride(QKeyEvent *event) override; | - | ||||||||||||
892 | static QByteArray keyToSignal(int key); | - | ||||||||||||
893 | - | |||||||||||||
894 | bool isConnected(const char *signalName) const; | - | ||||||||||||
895 | }; | - | ||||||||||||
896 | - | |||||||||||||
897 | Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const | - | ||||||||||||
898 | { | - | ||||||||||||
899 | return ((extra.flag() ? Qt::LeftButton : Qt::MouseButton(0)) | executed 19879 times by 20 tests: return ((extra.flag() ? Qt::LeftButton : Qt::MouseButton(0)) | (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons(nullptr))); Executed by:
| 19879 | ||||||||||||
900 | (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons(nullptr))); executed 19879 times by 20 tests: return ((extra.flag() ? Qt::LeftButton : Qt::MouseButton(0)) | (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons(nullptr))); Executed by:
| 19879 | ||||||||||||
901 | } | - | ||||||||||||
902 | - | |||||||||||||
903 | QSGContext *QQuickItemPrivate::sceneGraphContext() const | - | ||||||||||||
904 | { | - | ||||||||||||
905 | Q_ASSERT(window); | - | ||||||||||||
906 | return static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(window))->context->sceneGraphContext(); executed 77323 times by 71 tests: return static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(window))->context->sceneGraphContext(); Executed by:
| 77323 | ||||||||||||
907 | } | - | ||||||||||||
908 | - | |||||||||||||
909 | QSGRenderContext *QQuickItemPrivate::sceneGraphRenderContext() const | - | ||||||||||||
910 | { | - | ||||||||||||
911 | Q_ASSERT(window); | - | ||||||||||||
912 | return static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(window))->context; executed 255636 times by 57 tests: return static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(window))->context; Executed by:
| 255636 | ||||||||||||
913 | } | - | ||||||||||||
914 | - | |||||||||||||
915 | void QQuickItemPrivate::markSortedChildrenDirty(QQuickItem *child) | - | ||||||||||||
916 | { | - | ||||||||||||
917 | // If sortedChildItems == &childItems then all in childItems have z == 0 | - | ||||||||||||
918 | // and we don't need to invalidate if the changed item also has z == 0. | - | ||||||||||||
919 | if (child->z() != 0. || sortedChildItems != &childItems) {
| 12694-669606 | ||||||||||||
920 | if (sortedChildItems != &childItems)
| 4286-169090 | ||||||||||||
921 | delete sortedChildItems; executed 169090 times by 16 tests: delete sortedChildItems; Executed by:
| 169090 | ||||||||||||
922 | sortedChildItems = nullptr; | - | ||||||||||||
923 | } executed 173376 times by 16 tests: end of block Executed by:
| 173376 | ||||||||||||
924 | } executed 830288 times by 107 tests: end of block Executed by:
| 830288 | ||||||||||||
925 | - | |||||||||||||
926 | QQuickItem::TransformOrigin QQuickItemPrivate::origin() const | - | ||||||||||||
927 | { | - | ||||||||||||
928 | return extra.isAllocated()?extra->origin:QQuickItem::Center; executed 53226 times by 82 tests: return extra.isAllocated()?extra->origin:QQuickItem::Center; Executed by:
| 53226 | ||||||||||||
929 | } | - | ||||||||||||
930 | - | |||||||||||||
931 | QSGTransformNode *QQuickItemPrivate::itemNode() | - | ||||||||||||
932 | { | - | ||||||||||||
933 | if (!itemNodeInstance) {
| 323650-1602998 | ||||||||||||
934 | itemNodeInstance = createTransformNode(); | - | ||||||||||||
935 | itemNodeInstance->setFlag(QSGNode::OwnedByParent, false); | - | ||||||||||||
936 | #ifdef QSG_RUNTIME_DESCRIPTION | - | ||||||||||||
937 | Q_Q(QQuickItem); | - | ||||||||||||
938 | qsgnode_set_description(itemNodeInstance, QString::fromLatin1("QQuickItem(%1:%2)").arg(QString::fromLatin1(q->metaObject()->className())).arg(q->objectName())); | - | ||||||||||||
939 | #endif | - | ||||||||||||
940 | } executed 323650 times by 76 tests: end of block Executed by:
| 323650 | ||||||||||||
941 | return itemNodeInstance; executed 1926648 times by 76 tests: return itemNodeInstance; Executed by:
| 1926648 | ||||||||||||
942 | } | - | ||||||||||||
943 | - | |||||||||||||
944 | QSGNode *QQuickItemPrivate::childContainerNode() | - | ||||||||||||
945 | { | - | ||||||||||||
946 | if (rootNode())
| 398-703659 | ||||||||||||
947 | return rootNode(); executed 398 times by 6 tests: return rootNode(); Executed by:
| 398 | ||||||||||||
948 | else if (clipNode())
| 580-703079 | ||||||||||||
949 | return clipNode(); executed 580 times by 8 tests: return clipNode(); Executed by:
| 580 | ||||||||||||
950 | else if (opacityNode())
| 43690-659389 | ||||||||||||
951 | return opacityNode(); executed 43690 times by 26 tests: return opacityNode(); Executed by:
| 43690 | ||||||||||||
952 | else | - | ||||||||||||
953 | return itemNode(); executed 659389 times by 77 tests: return itemNode(); Executed by:
| 659389 | ||||||||||||
954 | } | - | ||||||||||||
955 | - | |||||||||||||
956 | Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes) | - | ||||||||||||
957 | Q_DECLARE_TYPEINFO(QQuickItemPrivate::ChangeListener, Q_PRIMITIVE_TYPE); | - | ||||||||||||
958 | - | |||||||||||||
959 | QT_END_NAMESPACE | - | ||||||||||||
960 | - | |||||||||||||
961 | #if QT_CONFIG(quick_shadereffect) | - | ||||||||||||
962 | QML_DECLARE_TYPE(QQuickItemLayer) | - | ||||||||||||
963 | #endif | - | ||||||||||||
964 | QML_DECLARE_TYPE(QQuickKeysAttached) | - | ||||||||||||
965 | QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES) | - | ||||||||||||
966 | QML_DECLARE_TYPE(QQuickKeyNavigationAttached) | - | ||||||||||||
967 | QML_DECLARE_TYPEINFO(QQuickKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES) | - | ||||||||||||
968 | QML_DECLARE_TYPE(QQuickLayoutMirroringAttached) | - | ||||||||||||
969 | QML_DECLARE_TYPEINFO(QQuickLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES) | - | ||||||||||||
970 | QML_DECLARE_TYPE(QQuickEnterKeyAttached) | - | ||||||||||||
971 | QML_DECLARE_TYPEINFO(QQuickEnterKeyAttached, QML_HAS_ATTACHED_PROPERTIES) | - | ||||||||||||
972 | - | |||||||||||||
973 | #endif // QQUICKITEM_P_H | - | ||||||||||||
Source code | Switch to Preprocessed file |