Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickdrag.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | class QQuickDragAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener | - | ||||||||||||||||||
8 | { | - | ||||||||||||||||||
9 | inline QQuickDragAttached* q_func() { return static_cast<QQuickDragAttached *>(q_ptr); } inline const QQuickDragAttached* q_func() const { return static_cast<const QQuickDragAttached *>(q_ptr); } friend class QQuickDragAttached; | - | ||||||||||||||||||
10 | public: | - | ||||||||||||||||||
11 | static QQuickDragAttachedPrivate *get(QQuickDragAttached *attached) { | - | ||||||||||||||||||
12 | return never executed: static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached));return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); never executed: }return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); | 0 | ||||||||||||||||||
13 | - | |||||||||||||||||||
14 | QQuickDragAttachedPrivate() | - | ||||||||||||||||||
15 | : attachedItem(nullptr) | - | ||||||||||||||||||
16 | , mimeData(nullptr) | - | ||||||||||||||||||
17 | , proposedAction(Qt::MoveAction) | - | ||||||||||||||||||
18 | , supportedActions(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction) | - | ||||||||||||||||||
19 | , active(false) | - | ||||||||||||||||||
20 | , listening(false) | - | ||||||||||||||||||
21 | , inEvent(false) | - | ||||||||||||||||||
22 | , dragRestarted(false) | - | ||||||||||||||||||
23 | , itemMoved(false) | - | ||||||||||||||||||
24 | , eventQueued(false) | - | ||||||||||||||||||
25 | , overrideActions(false) | - | ||||||||||||||||||
26 | , dragType(QQuickDrag::Internal) | - | ||||||||||||||||||
27 | { | - | ||||||||||||||||||
28 | } executed 390 times by 4 tests: end of block Executed by:
| 390 | ||||||||||||||||||
29 | - | |||||||||||||||||||
30 | void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override; | - | ||||||||||||||||||
31 | void itemParentChanged(QQuickItem *, QQuickItem *parent) override; | - | ||||||||||||||||||
32 | void updatePosition(); | - | ||||||||||||||||||
33 | void restartDrag(); | - | ||||||||||||||||||
34 | void deliverEnterEvent(); | - | ||||||||||||||||||
35 | void deliverMoveEvent(); | - | ||||||||||||||||||
36 | void deliverLeaveEvent(); | - | ||||||||||||||||||
37 | void deliverEvent(QQuickWindow *window, QEvent *event); | - | ||||||||||||||||||
38 | void start(Qt::DropActions supportedActions); | - | ||||||||||||||||||
39 | Qt::DropAction startDrag(Qt::DropActions supportedActions); | - | ||||||||||||||||||
40 | void setTarget(QQuickItem *item); | - | ||||||||||||||||||
41 | - | |||||||||||||||||||
42 | QQuickDragGrabber dragGrabber; | - | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | QPointer<QObject> source; | - | ||||||||||||||||||
45 | QPointer<QObject> target; | - | ||||||||||||||||||
46 | QPointer<QQuickWindow> window; | - | ||||||||||||||||||
47 | QQuickItem *attachedItem; | - | ||||||||||||||||||
48 | QQuickDragMimeData *mimeData; | - | ||||||||||||||||||
49 | Qt::DropAction proposedAction; | - | ||||||||||||||||||
50 | Qt::DropActions supportedActions; | - | ||||||||||||||||||
51 | bool active : 1; | - | ||||||||||||||||||
52 | bool listening : 1; | - | ||||||||||||||||||
53 | bool inEvent : 1; | - | ||||||||||||||||||
54 | bool dragRestarted : 1; | - | ||||||||||||||||||
55 | bool itemMoved : 1; | - | ||||||||||||||||||
56 | bool eventQueued : 1; | - | ||||||||||||||||||
57 | bool overrideActions : 1; | - | ||||||||||||||||||
58 | QPointF hotSpot; | - | ||||||||||||||||||
59 | QUrl imageSource; | - | ||||||||||||||||||
60 | QQuickPixmap pixmapLoader; | - | ||||||||||||||||||
61 | QStringList keys; | - | ||||||||||||||||||
62 | QVariantMap externalMimeData; | - | ||||||||||||||||||
63 | QQuickDrag::DragType dragType; | - | ||||||||||||||||||
64 | }; | - | ||||||||||||||||||
65 | void QQuickDragAttachedPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, | - | ||||||||||||||||||
66 | const QRectF &) | - | ||||||||||||||||||
67 | { | - | ||||||||||||||||||
68 | if (!change.positionChange()
| 0-214 | ||||||||||||||||||
69 | return; executed 24 times by 3 tests: return; Executed by:
| 24 | ||||||||||||||||||
70 | updatePosition(); | - | ||||||||||||||||||
71 | } executed 190 times by 3 tests: end of block Executed by:
| 190 | ||||||||||||||||||
72 | - | |||||||||||||||||||
73 | void QQuickDragAttachedPrivate::itemParentChanged(QQuickItem *, QQuickItem *) | - | ||||||||||||||||||
74 | { | - | ||||||||||||||||||
75 | if (!active
| 0-82 | ||||||||||||||||||
76 | return; executed 82 times by 3 tests: return; Executed by:
| 82 | ||||||||||||||||||
77 | - | |||||||||||||||||||
78 | QQuickWindow *newWindow = attachedItem->window(); | - | ||||||||||||||||||
79 | - | |||||||||||||||||||
80 | if (window != newWindow
| 6-24 | ||||||||||||||||||
81 | restartDrag(); executed 24 times by 2 tests: restartDrag(); Executed by:
| 24 | ||||||||||||||||||
82 | else if (window
| 0-6 | ||||||||||||||||||
83 | updatePosition(); executed 6 times by 2 tests: updatePosition(); Executed by:
| 6 | ||||||||||||||||||
84 | } executed 30 times by 3 tests: end of block Executed by:
| 30 | ||||||||||||||||||
85 | - | |||||||||||||||||||
86 | void QQuickDragAttachedPrivate::updatePosition() | - | ||||||||||||||||||
87 | { | - | ||||||||||||||||||
88 | QQuickDragAttached * const q = q_func(); | - | ||||||||||||||||||
89 | itemMoved = true; | - | ||||||||||||||||||
90 | if (!eventQueued
| 4-200 | ||||||||||||||||||
91 | eventQueued = true; | - | ||||||||||||||||||
92 | QCoreApplication::postEvent(q, new QEvent(QEvent::User)); | - | ||||||||||||||||||
93 | } executed 200 times by 3 tests: end of block Executed by:
| 200 | ||||||||||||||||||
94 | } executed 204 times by 3 tests: end of block Executed by:
| 204 | ||||||||||||||||||
95 | - | |||||||||||||||||||
96 | void QQuickDragAttachedPrivate::restartDrag() | - | ||||||||||||||||||
97 | { | - | ||||||||||||||||||
98 | QQuickDragAttached * const q = q_func(); | - | ||||||||||||||||||
99 | dragRestarted = true; | - | ||||||||||||||||||
100 | if (!eventQueued
| 0-30 | ||||||||||||||||||
101 | eventQueued = true; | - | ||||||||||||||||||
102 | QCoreApplication::postEvent(q, new QEvent(QEvent::User)); | - | ||||||||||||||||||
103 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||||||||||||||
104 | } executed 30 times by 2 tests: end of block Executed by:
| 30 | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | void QQuickDragAttachedPrivate::deliverEnterEvent() | - | ||||||||||||||||||
107 | { | - | ||||||||||||||||||
108 | dragRestarted = false; | - | ||||||||||||||||||
109 | itemMoved = false; | - | ||||||||||||||||||
110 | - | |||||||||||||||||||
111 | window = attachedItem->window(); | - | ||||||||||||||||||
112 | - | |||||||||||||||||||
113 | mimeData->m_source = source; | - | ||||||||||||||||||
114 | if (!overrideActions
| 2-196 | ||||||||||||||||||
115 | mimeData->m_supportedActions = supportedActions; executed 196 times by 3 tests: mimeData->m_supportedActions = supportedActions; Executed by:
| 196 | ||||||||||||||||||
116 | mimeData->m_keys = keys; | - | ||||||||||||||||||
117 | - | |||||||||||||||||||
118 | if (window
| 4-194 | ||||||||||||||||||
119 | QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint(); | - | ||||||||||||||||||
120 | QDragEnterEvent event(scenePos, mimeData->m_supportedActions, mimeData, Qt::NoButton, Qt::NoModifier); | - | ||||||||||||||||||
121 | QQuickDropEventEx::setProposedAction(&event, proposedAction); | - | ||||||||||||||||||
122 | deliverEvent(window, &event); | - | ||||||||||||||||||
123 | } executed 194 times by 3 tests: end of block Executed by:
| 194 | ||||||||||||||||||
124 | } executed 198 times by 3 tests: end of block Executed by:
| 198 | ||||||||||||||||||
125 | - | |||||||||||||||||||
126 | void QQuickDragAttachedPrivate::deliverMoveEvent() | - | ||||||||||||||||||
127 | { | - | ||||||||||||||||||
128 | QQuickDragAttached * const q = q_func(); | - | ||||||||||||||||||
129 | - | |||||||||||||||||||
130 | itemMoved = false; | - | ||||||||||||||||||
131 | if (window
| 6-194 | ||||||||||||||||||
132 | QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint(); | - | ||||||||||||||||||
133 | QDragMoveEvent event(scenePos, mimeData->m_supportedActions, mimeData, Qt::NoButton, Qt::NoModifier); | - | ||||||||||||||||||
134 | QQuickDropEventEx::setProposedAction(&event, proposedAction); | - | ||||||||||||||||||
135 | deliverEvent(window, &event); | - | ||||||||||||||||||
136 | if (target != dragGrabber.target()
| 12-182 | ||||||||||||||||||
137 | target = dragGrabber.target(); | - | ||||||||||||||||||
138 | q->targetChanged(); | - | ||||||||||||||||||
139 | } executed 12 times by 2 tests: end of block Executed by:
| 12 | ||||||||||||||||||
140 | } executed 194 times by 3 tests: end of block Executed by:
| 194 | ||||||||||||||||||
141 | } executed 200 times by 3 tests: end of block Executed by:
| 200 | ||||||||||||||||||
142 | - | |||||||||||||||||||
143 | void QQuickDragAttachedPrivate::deliverLeaveEvent() | - | ||||||||||||||||||
144 | { | - | ||||||||||||||||||
145 | if (window
| 4-132 | ||||||||||||||||||
146 | QDragLeaveEvent event; | - | ||||||||||||||||||
147 | deliverEvent(window, &event); | - | ||||||||||||||||||
148 | window = nullptr; | - | ||||||||||||||||||
149 | } executed 132 times by 3 tests: end of block Executed by:
| 132 | ||||||||||||||||||
150 | } executed 136 times by 3 tests: end of block Executed by:
| 136 | ||||||||||||||||||
151 | - | |||||||||||||||||||
152 | void QQuickDragAttachedPrivate::deliverEvent(QQuickWindow *window, QEvent *event) | - | ||||||||||||||||||
153 | { | - | ||||||||||||||||||
154 | ((!inEvent) ? static_cast<void>(0) : qt_assert("!inEvent", __FILE__, 240)); | - | ||||||||||||||||||
155 | inEvent = true; | - | ||||||||||||||||||
156 | QQuickWindowPrivate::get(window)->deliverDragEvent(&dragGrabber, event); | - | ||||||||||||||||||
157 | inEvent = false; | - | ||||||||||||||||||
158 | } executed 564 times by 3 tests: end of block Executed by:
| 564 | ||||||||||||||||||
159 | - | |||||||||||||||||||
160 | bool QQuickDragAttached::event(QEvent *event) | - | ||||||||||||||||||
161 | { | - | ||||||||||||||||||
162 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
163 | - | |||||||||||||||||||
164 | if (event->type() == QEvent::User
| 0-210 | ||||||||||||||||||
165 | d->eventQueued = false; | - | ||||||||||||||||||
166 | if (d->dragRestarted
| 12-198 | ||||||||||||||||||
167 | d->deliverLeaveEvent(); | - | ||||||||||||||||||
168 | d->deliverEnterEvent(); | - | ||||||||||||||||||
169 | - | |||||||||||||||||||
170 | if (d->target != d->dragGrabber.target()
| 6 | ||||||||||||||||||
171 | d->target = d->dragGrabber.target(); | - | ||||||||||||||||||
172 | targetChanged(); | - | ||||||||||||||||||
173 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
174 | } executed 12 times by 1 test: else if (d->itemMovedend of block Executed by:
| 2-196 | ||||||||||||||||||
175 | d->deliverMoveEvent(); | - | ||||||||||||||||||
176 | } executed 196 times by 3 tests: end of block Executed by:
| 196 | ||||||||||||||||||
177 | return executed 210 times by 3 tests: true;return true; Executed by:
executed 210 times by 3 tests: return true; Executed by:
| 210 | ||||||||||||||||||
178 | } else { | - | ||||||||||||||||||
179 | return never executed: QObject::event(event);return QObject::event(event); never executed: return QObject::event(event); | 0 | ||||||||||||||||||
180 | } | - | ||||||||||||||||||
181 | } | - | ||||||||||||||||||
182 | - | |||||||||||||||||||
183 | QQuickDragAttached::QQuickDragAttached(QObject *parent) | - | ||||||||||||||||||
184 | : QObject(*new QQuickDragAttachedPrivate, parent) | - | ||||||||||||||||||
185 | { | - | ||||||||||||||||||
186 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
187 | d->attachedItem = qobject_cast<QQuickItem *>(parent); | - | ||||||||||||||||||
188 | d->source = d->attachedItem; | - | ||||||||||||||||||
189 | } executed 390 times by 4 tests: end of block Executed by:
| 390 | ||||||||||||||||||
190 | - | |||||||||||||||||||
191 | QQuickDragAttached::~QQuickDragAttached() | - | ||||||||||||||||||
192 | { | - | ||||||||||||||||||
193 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
194 | delete d->mimeData; | - | ||||||||||||||||||
195 | } executed 390 times by 4 tests: end of block Executed by:
| 390 | ||||||||||||||||||
196 | bool QQuickDragAttached::isActive() const | - | ||||||||||||||||||
197 | { | - | ||||||||||||||||||
198 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
199 | return executed 332 times by 3 tests: d->active;return d->active; Executed by:
executed 332 times by 3 tests: return d->active; Executed by:
| 332 | ||||||||||||||||||
200 | } | - | ||||||||||||||||||
201 | - | |||||||||||||||||||
202 | void QQuickDragAttached::setActive(bool active) | - | ||||||||||||||||||
203 | { | - | ||||||||||||||||||
204 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
205 | if (d->active != active
| 198-310 | ||||||||||||||||||
206 | if (d->inEvent
| 8-190 | ||||||||||||||||||
207 | qmlWarning(this) << "active cannot be changed from within a drag event handler"; executed 8 times by 1 test: qmlWarning(this) << "active cannot be changed from within a drag event handler"; Executed by:
| 8 | ||||||||||||||||||
208 | else if (active
| 74-116 | ||||||||||||||||||
209 | if (d->dragType == QQuickDrag::Internal
| 2-114 | ||||||||||||||||||
210 | d->start(d->supportedActions); | - | ||||||||||||||||||
211 | } executed 114 times by 3 tests: else {end of block Executed by:
| 114 | ||||||||||||||||||
212 | d->active = true; | - | ||||||||||||||||||
213 | activeChanged(); | - | ||||||||||||||||||
214 | if (d->dragType == QQuickDrag::Automatic
| 0-2 | ||||||||||||||||||
215 | - | |||||||||||||||||||
216 | - | |||||||||||||||||||
217 | d->startDrag(d->supportedActions); | - | ||||||||||||||||||
218 | } never executed: end of block | 0 | ||||||||||||||||||
219 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
220 | } | - | ||||||||||||||||||
221 | else | - | ||||||||||||||||||
222 | cancel(); executed 74 times by 3 tests: cancel(); Executed by:
| 74 | ||||||||||||||||||
223 | } | - | ||||||||||||||||||
224 | } executed 508 times by 4 tests: end of block Executed by:
| 508 | ||||||||||||||||||
225 | QObject *QQuickDragAttached::source() const | - | ||||||||||||||||||
226 | { | - | ||||||||||||||||||
227 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
228 | return executed 14 times by 1 test: d->source;return d->source; Executed by:
executed 14 times by 1 test: return d->source; Executed by:
| 14 | ||||||||||||||||||
229 | } | - | ||||||||||||||||||
230 | - | |||||||||||||||||||
231 | void QQuickDragAttached::setSource(QObject *item) | - | ||||||||||||||||||
232 | { | - | ||||||||||||||||||
233 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
234 | if (d->source != item
| 0-198 | ||||||||||||||||||
235 | d->source = item; | - | ||||||||||||||||||
236 | if (d->active
| 2-196 | ||||||||||||||||||
237 | d->restartDrag(); executed 2 times by 1 test: d->restartDrag(); Executed by:
| 2 | ||||||||||||||||||
238 | sourceChanged(); | - | ||||||||||||||||||
239 | } executed 198 times by 4 tests: end of block Executed by:
| 198 | ||||||||||||||||||
240 | } executed 198 times by 4 tests: end of block Executed by:
| 198 | ||||||||||||||||||
241 | - | |||||||||||||||||||
242 | void QQuickDragAttached::resetSource() | - | ||||||||||||||||||
243 | { | - | ||||||||||||||||||
244 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
245 | if (d->source != d->attachedItem
| 0-2 | ||||||||||||||||||
246 | d->source = d->attachedItem; | - | ||||||||||||||||||
247 | if (d->active
| 0-2 | ||||||||||||||||||
248 | d->restartDrag(); never executed: d->restartDrag(); | 0 | ||||||||||||||||||
249 | sourceChanged(); | - | ||||||||||||||||||
250 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
251 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
252 | QObject *QQuickDragAttached::target() const | - | ||||||||||||||||||
253 | { | - | ||||||||||||||||||
254 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
255 | return executed 136 times by 1 test: d->target;return d->target; Executed by:
executed 136 times by 1 test: return d->target; Executed by:
| 136 | ||||||||||||||||||
256 | } | - | ||||||||||||||||||
257 | QPointF QQuickDragAttached::hotSpot() const | - | ||||||||||||||||||
258 | { | - | ||||||||||||||||||
259 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
260 | return executed 390 times by 3 tests: d->hotSpot;return d->hotSpot; Executed by:
executed 390 times by 3 tests: return d->hotSpot; Executed by:
| 390 | ||||||||||||||||||
261 | } | - | ||||||||||||||||||
262 | - | |||||||||||||||||||
263 | void QQuickDragAttached::setHotSpot(const QPointF &hotSpot) | - | ||||||||||||||||||
264 | { | - | ||||||||||||||||||
265 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
266 | if (d->hotSpot != hotSpot
| 60-294 | ||||||||||||||||||
267 | d->hotSpot = hotSpot; | - | ||||||||||||||||||
268 | - | |||||||||||||||||||
269 | if (d->active
| 4-290 | ||||||||||||||||||
270 | d->updatePosition(); executed 4 times by 1 test: d->updatePosition(); Executed by:
| 4 | ||||||||||||||||||
271 | - | |||||||||||||||||||
272 | hotSpotChanged(); | - | ||||||||||||||||||
273 | } executed 294 times by 3 tests: end of block Executed by:
| 294 | ||||||||||||||||||
274 | } executed 354 times by 3 tests: end of block Executed by:
| 354 | ||||||||||||||||||
275 | QUrl QQuickDragAttached::imageSource() const | - | ||||||||||||||||||
276 | { | - | ||||||||||||||||||
277 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
278 | return never executed: d->imageSource;return d->imageSource; never executed: return d->imageSource; | 0 | ||||||||||||||||||
279 | } | - | ||||||||||||||||||
280 | - | |||||||||||||||||||
281 | void QQuickDragAttached::setImageSource(const QUrl &url) | - | ||||||||||||||||||
282 | { | - | ||||||||||||||||||
283 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
284 | if (d->imageSource != url
| 0 | ||||||||||||||||||
285 | d->imageSource = url; | - | ||||||||||||||||||
286 | - | |||||||||||||||||||
287 | if (url.isEmpty()
| 0 | ||||||||||||||||||
288 | d->pixmapLoader.clear(); | - | ||||||||||||||||||
289 | } never executed: else {end of block | 0 | ||||||||||||||||||
290 | d->pixmapLoader.load(qmlEngine(this), url); | - | ||||||||||||||||||
291 | } never executed: end of block | 0 | ||||||||||||||||||
292 | - | |||||||||||||||||||
293 | imageSourceChanged(); | - | ||||||||||||||||||
294 | } never executed: end of block | 0 | ||||||||||||||||||
295 | } never executed: end of block | 0 | ||||||||||||||||||
296 | QStringList QQuickDragAttached::keys() const | - | ||||||||||||||||||
297 | { | - | ||||||||||||||||||
298 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
299 | return executed 10 times by 1 test: d->keys;return d->keys; Executed by:
executed 10 times by 1 test: return d->keys; Executed by:
| 10 | ||||||||||||||||||
300 | } | - | ||||||||||||||||||
301 | - | |||||||||||||||||||
302 | void QQuickDragAttached::setKeys(const QStringList &keys) | - | ||||||||||||||||||
303 | { | - | ||||||||||||||||||
304 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
305 | if (d->keys != keys
| 0-54 | ||||||||||||||||||
306 | d->keys = keys; | - | ||||||||||||||||||
307 | if (d->active
| 2-52 | ||||||||||||||||||
308 | d->restartDrag(); executed 2 times by 1 test: d->restartDrag(); Executed by:
| 2 | ||||||||||||||||||
309 | keysChanged(); | - | ||||||||||||||||||
310 | } executed 54 times by 3 tests: end of block Executed by:
| 54 | ||||||||||||||||||
311 | } executed 54 times by 3 tests: end of block Executed by:
| 54 | ||||||||||||||||||
312 | QVariantMap QQuickDragAttached::mimeData() const | - | ||||||||||||||||||
313 | { | - | ||||||||||||||||||
314 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
315 | return never executed: d->externalMimeData;return d->externalMimeData; never executed: return d->externalMimeData; | 0 | ||||||||||||||||||
316 | } | - | ||||||||||||||||||
317 | - | |||||||||||||||||||
318 | void QQuickDragAttached::setMimeData(const QVariantMap &mimeData) | - | ||||||||||||||||||
319 | { | - | ||||||||||||||||||
320 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
321 | if (d->externalMimeData != mimeData
| 0-2 | ||||||||||||||||||
322 | d->externalMimeData = mimeData; | - | ||||||||||||||||||
323 | mimeDataChanged(); | - | ||||||||||||||||||
324 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
325 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
326 | Qt::DropActions QQuickDragAttached::supportedActions() const | - | ||||||||||||||||||
327 | { | - | ||||||||||||||||||
328 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
329 | return executed 16 times by 1 test: d->supportedActions;return d->supportedActions; Executed by:
executed 16 times by 1 test: return d->supportedActions; Executed by:
| 16 | ||||||||||||||||||
330 | } | - | ||||||||||||||||||
331 | - | |||||||||||||||||||
332 | void QQuickDragAttached::setSupportedActions(Qt::DropActions actions) | - | ||||||||||||||||||
333 | { | - | ||||||||||||||||||
334 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
335 | if (d->supportedActions != actions
| 0-8 | ||||||||||||||||||
336 | d->supportedActions = actions; | - | ||||||||||||||||||
337 | if (d->active
| 2-6 | ||||||||||||||||||
338 | d->restartDrag(); executed 2 times by 1 test: d->restartDrag(); Executed by:
| 2 | ||||||||||||||||||
339 | supportedActionsChanged(); | - | ||||||||||||||||||
340 | } executed 8 times by 3 tests: end of block Executed by:
| 8 | ||||||||||||||||||
341 | } executed 8 times by 3 tests: end of block Executed by:
| 8 | ||||||||||||||||||
342 | Qt::DropAction QQuickDragAttached::proposedAction() const | - | ||||||||||||||||||
343 | { | - | ||||||||||||||||||
344 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
345 | return executed 16 times by 1 test: d->proposedAction;return d->proposedAction; Executed by:
executed 16 times by 1 test: return d->proposedAction; Executed by:
| 16 | ||||||||||||||||||
346 | } | - | ||||||||||||||||||
347 | - | |||||||||||||||||||
348 | void QQuickDragAttached::setProposedAction(Qt::DropAction action) | - | ||||||||||||||||||
349 | { | - | ||||||||||||||||||
350 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
351 | if (d->proposedAction != action
| 0-8 | ||||||||||||||||||
352 | d->proposedAction = action; | - | ||||||||||||||||||
353 | - | |||||||||||||||||||
354 | - | |||||||||||||||||||
355 | - | |||||||||||||||||||
356 | if (d->active
| 4 | ||||||||||||||||||
357 | d->updatePosition(); executed 4 times by 1 test: d->updatePosition(); Executed by:
| 4 | ||||||||||||||||||
358 | proposedActionChanged(); | - | ||||||||||||||||||
359 | } executed 8 times by 2 tests: end of block Executed by:
| 8 | ||||||||||||||||||
360 | } executed 8 times by 2 tests: end of block Executed by:
| 8 | ||||||||||||||||||
361 | QQuickDrag::DragType QQuickDragAttached::dragType() const | - | ||||||||||||||||||
362 | { | - | ||||||||||||||||||
363 | const QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
364 | return never executed: d->dragType;return d->dragType; never executed: return d->dragType; | 0 | ||||||||||||||||||
365 | } | - | ||||||||||||||||||
366 | - | |||||||||||||||||||
367 | void QQuickDragAttached::setDragType(QQuickDrag::DragType dragType) | - | ||||||||||||||||||
368 | { | - | ||||||||||||||||||
369 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
370 | if (d->dragType != dragType
| 2-4 | ||||||||||||||||||
371 | d->dragType = dragType; | - | ||||||||||||||||||
372 | dragTypeChanged(); | - | ||||||||||||||||||
373 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||
374 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||
375 | - | |||||||||||||||||||
376 | void QQuickDragAttachedPrivate::start(Qt::DropActions supportedActions) | - | ||||||||||||||||||
377 | { | - | ||||||||||||||||||
378 | QQuickDragAttached * const q = q_func(); | - | ||||||||||||||||||
379 | ((!active) ? static_cast<void>(0) : qt_assert("!active", __FILE__, 593)); | - | ||||||||||||||||||
380 | - | |||||||||||||||||||
381 | if (!mimeData
| 90-96 | ||||||||||||||||||
382 | mimeData = new QQuickDragMimeData; executed 90 times by 3 tests: mimeData = new QQuickDragMimeData; Executed by:
| 90 | ||||||||||||||||||
383 | if (!listening
| 90-96 | ||||||||||||||||||
384 | QQuickItemPrivate::get(attachedItem)->addItemChangeListener( | - | ||||||||||||||||||
385 | this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Parent); | - | ||||||||||||||||||
386 | listening = true; | - | ||||||||||||||||||
387 | } executed 90 times by 3 tests: end of block Executed by:
| 90 | ||||||||||||||||||
388 | - | |||||||||||||||||||
389 | mimeData->m_supportedActions = supportedActions; | - | ||||||||||||||||||
390 | active = true; | - | ||||||||||||||||||
391 | itemMoved = false; | - | ||||||||||||||||||
392 | dragRestarted = false; | - | ||||||||||||||||||
393 | - | |||||||||||||||||||
394 | deliverEnterEvent(); | - | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | if (target != dragGrabber.target()
| 36-150 | ||||||||||||||||||
397 | target = dragGrabber.target(); | - | ||||||||||||||||||
398 | q->targetChanged(); | - | ||||||||||||||||||
399 | } executed 150 times by 3 tests: end of block Executed by:
| 150 | ||||||||||||||||||
400 | - | |||||||||||||||||||
401 | q->activeChanged(); | - | ||||||||||||||||||
402 | } executed 186 times by 3 tests: end of block Executed by:
| 186 | ||||||||||||||||||
403 | void QQuickDragAttached::start(QQmlV4Function *args) | - | ||||||||||||||||||
404 | { | - | ||||||||||||||||||
405 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
406 | if (d->inEvent
| 8-72 | ||||||||||||||||||
407 | qmlWarning(this) << "start() cannot be called from within a drag event handler"; | - | ||||||||||||||||||
408 | return; executed 8 times by 1 test: return; Executed by:
| 8 | ||||||||||||||||||
409 | } | - | ||||||||||||||||||
410 | - | |||||||||||||||||||
411 | if (d->active
| 6-66 | ||||||||||||||||||
412 | cancel(); executed 6 times by 1 test: cancel(); Executed by:
| 6 | ||||||||||||||||||
413 | - | |||||||||||||||||||
414 | d->overrideActions = false; | - | ||||||||||||||||||
415 | Qt::DropActions supportedActions = d->supportedActions; | - | ||||||||||||||||||
416 | - | |||||||||||||||||||
417 | if (args->length() >= 1
| 2-70 | ||||||||||||||||||
418 | QV4::Scope scope(args->v4engine()); | - | ||||||||||||||||||
419 | QV4::ScopedValue v(scope, (*args)[0]); | - | ||||||||||||||||||
420 | if (v->isInt32()
| 0-2 | ||||||||||||||||||
421 | supportedActions = Qt::DropActions(v->integerValue()); | - | ||||||||||||||||||
422 | d->overrideActions = true; | - | ||||||||||||||||||
423 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
424 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
425 | - | |||||||||||||||||||
426 | d->start(supportedActions); | - | ||||||||||||||||||
427 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||
428 | int QQuickDragAttached::drop() | - | ||||||||||||||||||
429 | { | - | ||||||||||||||||||
430 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
431 | Qt::DropAction acceptedAction = Qt::IgnoreAction; | - | ||||||||||||||||||
432 | - | |||||||||||||||||||
433 | if (d->inEvent
| 8-46 | ||||||||||||||||||
434 | qmlWarning(this) << "drop() cannot be called from within a drag event handler"; | - | ||||||||||||||||||
435 | return executed 8 times by 1 test: acceptedAction;return acceptedAction; Executed by:
executed 8 times by 1 test: return acceptedAction; Executed by:
| 8 | ||||||||||||||||||
436 | } | - | ||||||||||||||||||
437 | - | |||||||||||||||||||
438 | if (d->itemMoved
| 4-42 | ||||||||||||||||||
439 | d->deliverMoveEvent(); executed 4 times by 1 test: d->deliverMoveEvent(); Executed by:
| 4 | ||||||||||||||||||
440 | - | |||||||||||||||||||
441 | if (!d->active
| 2-44 | ||||||||||||||||||
442 | return executed 2 times by 1 test: acceptedAction;return acceptedAction; Executed by:
executed 2 times by 1 test: return acceptedAction; Executed by:
| 2 | ||||||||||||||||||
443 | d->active = false; | - | ||||||||||||||||||
444 | - | |||||||||||||||||||
445 | QObject *target = nullptr; | - | ||||||||||||||||||
446 | - | |||||||||||||||||||
447 | if (d->window
| 0-44 | ||||||||||||||||||
448 | QPoint scenePos = d->attachedItem->mapToScene(d->hotSpot).toPoint(); | - | ||||||||||||||||||
449 | - | |||||||||||||||||||
450 | QDropEvent event( | - | ||||||||||||||||||
451 | scenePos, d->mimeData->m_supportedActions, d->mimeData, Qt::NoButton, Qt::NoModifier); | - | ||||||||||||||||||
452 | QQuickDropEventEx::setProposedAction(&event, d->proposedAction); | - | ||||||||||||||||||
453 | d->deliverEvent(d->window, &event); | - | ||||||||||||||||||
454 | - | |||||||||||||||||||
455 | if (event.isAccepted()
| 6-38 | ||||||||||||||||||
456 | acceptedAction = event.dropAction(); | - | ||||||||||||||||||
457 | target = d->dragGrabber.target(); | - | ||||||||||||||||||
458 | } executed 38 times by 2 tests: end of block Executed by:
| 38 | ||||||||||||||||||
459 | } executed 44 times by 2 tests: end of block Executed by:
| 44 | ||||||||||||||||||
460 | - | |||||||||||||||||||
461 | if (d->target != target
| 6-38 | ||||||||||||||||||
462 | d->target = target; | - | ||||||||||||||||||
463 | targetChanged(); | - | ||||||||||||||||||
464 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||
465 | - | |||||||||||||||||||
466 | activeChanged(); | - | ||||||||||||||||||
467 | return executed 44 times by 2 tests: acceptedAction;return acceptedAction; Executed by:
executed 44 times by 2 tests: return acceptedAction; Executed by:
| 44 | ||||||||||||||||||
468 | } | - | ||||||||||||||||||
469 | - | |||||||||||||||||||
470 | - | |||||||||||||||||||
471 | - | |||||||||||||||||||
472 | - | |||||||||||||||||||
473 | - | |||||||||||||||||||
474 | - | |||||||||||||||||||
475 | - | |||||||||||||||||||
476 | void QQuickDragAttached::cancel() | - | ||||||||||||||||||
477 | { | - | ||||||||||||||||||
478 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
479 | - | |||||||||||||||||||
480 | if (d->inEvent
| 8-126 | ||||||||||||||||||
481 | qmlWarning(this) << "cancel() cannot be called from within a drag event handler"; | - | ||||||||||||||||||
482 | return; executed 8 times by 1 test: return; Executed by:
| 8 | ||||||||||||||||||
483 | } | - | ||||||||||||||||||
484 | - | |||||||||||||||||||
485 | if (!d->active
| 2-124 | ||||||||||||||||||
486 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
487 | d->active = false; | - | ||||||||||||||||||
488 | d->deliverLeaveEvent(); | - | ||||||||||||||||||
489 | - | |||||||||||||||||||
490 | if (d->target
| 16-108 | ||||||||||||||||||
491 | d->target = nullptr; | - | ||||||||||||||||||
492 | targetChanged(); | - | ||||||||||||||||||
493 | } executed 108 times by 3 tests: end of block Executed by:
| 108 | ||||||||||||||||||
494 | - | |||||||||||||||||||
495 | activeChanged(); | - | ||||||||||||||||||
496 | } executed 124 times by 3 tests: end of block Executed by:
| 124 | ||||||||||||||||||
497 | Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedActions) | - | ||||||||||||||||||
498 | { | - | ||||||||||||||||||
499 | QQuickDragAttached * const q = q_func(); | - | ||||||||||||||||||
500 | - | |||||||||||||||||||
501 | QDrag *drag = new QDrag(source ? source : q); | - | ||||||||||||||||||
502 | QMimeData *mimeData = new QMimeData(); | - | ||||||||||||||||||
503 | - | |||||||||||||||||||
504 | for (auto it = externalMimeData.cbegin(), end = externalMimeData.cend(); it != end
| 0 | ||||||||||||||||||
505 | mimeData->setData(it.key(), it.value().toString().toUtf8()); never executed: mimeData->setData(it.key(), it.value().toString().toUtf8()); | 0 | ||||||||||||||||||
506 | - | |||||||||||||||||||
507 | drag->setMimeData(mimeData); | - | ||||||||||||||||||
508 | if (pixmapLoader.isReady()
| 0 | ||||||||||||||||||
509 | drag->setPixmap(QPixmap::fromImage(pixmapLoader.image())); | - | ||||||||||||||||||
510 | } never executed: end of block | 0 | ||||||||||||||||||
511 | - | |||||||||||||||||||
512 | drag->setHotSpot(hotSpot.toPoint()); | - | ||||||||||||||||||
513 | q->dragStarted(); | - | ||||||||||||||||||
514 | - | |||||||||||||||||||
515 | Qt::DropAction dropAction = drag->exec(supportedActions); | - | ||||||||||||||||||
516 | - | |||||||||||||||||||
517 | if (!QGuiApplicationPrivate::platformIntegration()->drag()->ownsDragObject()
| 0 | ||||||||||||||||||
518 | drag->deleteLater(); never executed: drag->deleteLater(); | 0 | ||||||||||||||||||
519 | - | |||||||||||||||||||
520 | deliverLeaveEvent(); | - | ||||||||||||||||||
521 | - | |||||||||||||||||||
522 | if (target
| 0 | ||||||||||||||||||
523 | target = nullptr; | - | ||||||||||||||||||
524 | q->targetChanged(); | - | ||||||||||||||||||
525 | } never executed: end of block | 0 | ||||||||||||||||||
526 | - | |||||||||||||||||||
527 | q->dragFinished(dropAction); | - | ||||||||||||||||||
528 | - | |||||||||||||||||||
529 | active = false; | - | ||||||||||||||||||
530 | q->activeChanged(); | - | ||||||||||||||||||
531 | - | |||||||||||||||||||
532 | return never executed: dropAction;return dropAction; never executed: return dropAction; | 0 | ||||||||||||||||||
533 | } | - | ||||||||||||||||||
534 | void QQuickDragAttached::startDrag(QQmlV4Function *args) | - | ||||||||||||||||||
535 | { | - | ||||||||||||||||||
536 | QQuickDragAttachedPrivate * const d = d_func(); | - | ||||||||||||||||||
537 | - | |||||||||||||||||||
538 | if (d->inEvent
| 0 | ||||||||||||||||||
539 | qmlWarning(this) << "startDrag() cannot be called from within a drag event handler"; | - | ||||||||||||||||||
540 | return; never executed: return; | 0 | ||||||||||||||||||
541 | } | - | ||||||||||||||||||
542 | - | |||||||||||||||||||
543 | if (!d->active
| 0 | ||||||||||||||||||
544 | qmlWarning(this) << "startDrag() drag must be active"; | - | ||||||||||||||||||
545 | return; never executed: return; | 0 | ||||||||||||||||||
546 | } | - | ||||||||||||||||||
547 | - | |||||||||||||||||||
548 | Qt::DropActions supportedActions = d->supportedActions; | - | ||||||||||||||||||
549 | - | |||||||||||||||||||
550 | - | |||||||||||||||||||
551 | if (args->length() >= 1
| 0 | ||||||||||||||||||
552 | QV4::Scope scope(args->v4engine()); | - | ||||||||||||||||||
553 | QV4::ScopedValue v(scope, (*args)[0]); | - | ||||||||||||||||||
554 | if (v->isInt32()
| 0 | ||||||||||||||||||
555 | supportedActions = Qt::DropActions(v->integerValue()); | - | ||||||||||||||||||
556 | } never executed: end of block | 0 | ||||||||||||||||||
557 | } never executed: end of block | 0 | ||||||||||||||||||
558 | - | |||||||||||||||||||
559 | Qt::DropAction dropAction = d->startDrag(supportedActions); | - | ||||||||||||||||||
560 | - | |||||||||||||||||||
561 | args->setReturnValue(QV4::Encode((int)dropAction)); | - | ||||||||||||||||||
562 | } never executed: end of block | 0 | ||||||||||||||||||
563 | - | |||||||||||||||||||
564 | QQuickDrag::QQuickDrag(QObject *parent) | - | ||||||||||||||||||
565 | : QObject(parent), _target(nullptr), _axis(XAndYAxis), _xmin(-3.40282346638528859812e+38F), | - | ||||||||||||||||||
566 | _xmax(3.40282346638528859812e+38F), _ymin(-3.40282346638528859812e+38F), _ymax(3.40282346638528859812e+38F), _active(false), _filterChildren(false), | - | ||||||||||||||||||
567 | _smoothed(true), _threshold(QGuiApplication::styleHints()->startDragDistance()) | - | ||||||||||||||||||
568 | { | - | ||||||||||||||||||
569 | } executed 452 times by 6 tests: end of block Executed by:
| 452 | ||||||||||||||||||
570 | - | |||||||||||||||||||
571 | QQuickDrag::~QQuickDrag() | - | ||||||||||||||||||
572 | { | - | ||||||||||||||||||
573 | } | - | ||||||||||||||||||
574 | - | |||||||||||||||||||
575 | QQuickItem *QQuickDrag::target() const | - | ||||||||||||||||||
576 | { | - | ||||||||||||||||||
577 | return executed 3208 times by 4 tests: _target;return _target; Executed by:
executed 3208 times by 4 tests: return _target; Executed by:
| 3208 | ||||||||||||||||||
578 | } | - | ||||||||||||||||||
579 | - | |||||||||||||||||||
580 | void QQuickDrag::setTarget(QQuickItem *t) | - | ||||||||||||||||||
581 | { | - | ||||||||||||||||||
582 | if (_target == t
| 2-408 | ||||||||||||||||||
583 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
584 | _target = t; | - | ||||||||||||||||||
585 | targetChanged(); | - | ||||||||||||||||||
586 | } executed 408 times by 5 tests: end of block Executed by:
| 408 | ||||||||||||||||||
587 | - | |||||||||||||||||||
588 | void QQuickDrag::resetTarget() | - | ||||||||||||||||||
589 | { | - | ||||||||||||||||||
590 | if (_target == nullptr
| 2-42 | ||||||||||||||||||
591 | return; executed 42 times by 1 test: return; Executed by:
| 42 | ||||||||||||||||||
592 | _target = nullptr; | - | ||||||||||||||||||
593 | targetChanged(); | - | ||||||||||||||||||
594 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
595 | - | |||||||||||||||||||
596 | QQuickDrag::Axis QQuickDrag::axis() const | - | ||||||||||||||||||
597 | { | - | ||||||||||||||||||
598 | return executed 690 times by 4 tests: _axis;return _axis; Executed by:
executed 690 times by 4 tests: return _axis; Executed by:
| 690 | ||||||||||||||||||
599 | } | - | ||||||||||||||||||
600 | - | |||||||||||||||||||
601 | void QQuickDrag::setAxis(QQuickDrag::Axis a) | - | ||||||||||||||||||
602 | { | - | ||||||||||||||||||
603 | if (_axis == a
| 64-100 | ||||||||||||||||||
604 | return; executed 64 times by 2 tests: return; Executed by:
| 64 | ||||||||||||||||||
605 | _axis = a; | - | ||||||||||||||||||
606 | axisChanged(); | - | ||||||||||||||||||
607 | } executed 100 times by 2 tests: end of block Executed by:
| 100 | ||||||||||||||||||
608 | - | |||||||||||||||||||
609 | qreal QQuickDrag::xmin() const | - | ||||||||||||||||||
610 | { | - | ||||||||||||||||||
611 | return executed 896 times by 5 tests: _xmin;return _xmin; Executed by:
executed 896 times by 5 tests: return _xmin; Executed by:
| 896 | ||||||||||||||||||
612 | } | - | ||||||||||||||||||
613 | - | |||||||||||||||||||
614 | void QQuickDrag::setXmin(qreal m) | - | ||||||||||||||||||
615 | { | - | ||||||||||||||||||
616 | if (_xmin == m
| 2-132 | ||||||||||||||||||
617 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
618 | _xmin = m; | - | ||||||||||||||||||
619 | minimumXChanged(); | - | ||||||||||||||||||
620 | } executed 132 times by 2 tests: end of block Executed by:
| 132 | ||||||||||||||||||
621 | - | |||||||||||||||||||
622 | qreal QQuickDrag::xmax() const | - | ||||||||||||||||||
623 | { | - | ||||||||||||||||||
624 | return executed 612 times by 5 tests: _xmax;return _xmax; Executed by:
executed 612 times by 5 tests: return _xmax; Executed by:
| 612 | ||||||||||||||||||
625 | } | - | ||||||||||||||||||
626 | - | |||||||||||||||||||
627 | void QQuickDrag::setXmax(qreal m) | - | ||||||||||||||||||
628 | { | - | ||||||||||||||||||
629 | if (_xmax == m
| 66-236 | ||||||||||||||||||
630 | return; executed 66 times by 2 tests: return; Executed by:
| 66 | ||||||||||||||||||
631 | _xmax = m; | - | ||||||||||||||||||
632 | maximumXChanged(); | - | ||||||||||||||||||
633 | } executed 236 times by 2 tests: end of block Executed by:
| 236 | ||||||||||||||||||
634 | - | |||||||||||||||||||
635 | qreal QQuickDrag::ymin() const | - | ||||||||||||||||||
636 | { | - | ||||||||||||||||||
637 | return executed 322 times by 4 tests: _ymin;return _ymin; Executed by:
executed 322 times by 4 tests: return _ymin; Executed by:
| 322 | ||||||||||||||||||
638 | } | - | ||||||||||||||||||
639 | - | |||||||||||||||||||
640 | void QQuickDrag::setYmin(qreal m) | - | ||||||||||||||||||
641 | { | - | ||||||||||||||||||
642 | if (_ymin == m
| 2-52 | ||||||||||||||||||
643 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
644 | _ymin = m; | - | ||||||||||||||||||
645 | minimumYChanged(); | - | ||||||||||||||||||
646 | } executed 52 times by 2 tests: end of block Executed by:
| 52 | ||||||||||||||||||
647 | - | |||||||||||||||||||
648 | qreal QQuickDrag::ymax() const | - | ||||||||||||||||||
649 | { | - | ||||||||||||||||||
650 | return executed 322 times by 4 tests: _ymax;return _ymax; Executed by:
executed 322 times by 4 tests: return _ymax; Executed by:
| 322 | ||||||||||||||||||
651 | } | - | ||||||||||||||||||
652 | - | |||||||||||||||||||
653 | void QQuickDrag::setYmax(qreal m) | - | ||||||||||||||||||
654 | { | - | ||||||||||||||||||
655 | if (_ymax == m
| 2-52 | ||||||||||||||||||
656 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
657 | _ymax = m; | - | ||||||||||||||||||
658 | maximumYChanged(); | - | ||||||||||||||||||
659 | } executed 52 times by 2 tests: end of block Executed by:
| 52 | ||||||||||||||||||
660 | - | |||||||||||||||||||
661 | bool QQuickDrag::smoothed() const | - | ||||||||||||||||||
662 | { | - | ||||||||||||||||||
663 | return executed 74 times by 4 tests: _smoothed;return _smoothed; Executed by:
executed 74 times by 4 tests: return _smoothed; Executed by:
| 74 | ||||||||||||||||||
664 | } | - | ||||||||||||||||||
665 | - | |||||||||||||||||||
666 | void QQuickDrag::setSmoothed(bool smooth) | - | ||||||||||||||||||
667 | { | - | ||||||||||||||||||
668 | if (_smoothed != smooth
| 0-2 | ||||||||||||||||||
669 | _smoothed = smooth; | - | ||||||||||||||||||
670 | smoothedChanged(); | - | ||||||||||||||||||
671 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
672 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
673 | - | |||||||||||||||||||
674 | qreal QQuickDrag::threshold() const | - | ||||||||||||||||||
675 | { | - | ||||||||||||||||||
676 | return executed 682 times by 4 tests: _threshold;return _threshold; Executed by:
executed 682 times by 4 tests: return _threshold; Executed by:
| 682 | ||||||||||||||||||
677 | } | - | ||||||||||||||||||
678 | - | |||||||||||||||||||
679 | void QQuickDrag::setThreshold(qreal value) | - | ||||||||||||||||||
680 | { | - | ||||||||||||||||||
681 | if (_threshold != value
| 2-22 | ||||||||||||||||||
682 | _threshold = value; | - | ||||||||||||||||||
683 | thresholdChanged(); | - | ||||||||||||||||||
684 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||
685 | } executed 24 times by 1 test: end of block Executed by:
| 24 | ||||||||||||||||||
686 | - | |||||||||||||||||||
687 | void QQuickDrag::resetThreshold() | - | ||||||||||||||||||
688 | { | - | ||||||||||||||||||
689 | setThreshold(QGuiApplication::styleHints()->startDragDistance()); | - | ||||||||||||||||||
690 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
691 | - | |||||||||||||||||||
692 | bool QQuickDrag::active() const | - | ||||||||||||||||||
693 | { | - | ||||||||||||||||||
694 | return executed 1562 times by 5 tests: _active;return _active; Executed by:
executed 1562 times by 5 tests: return _active; Executed by:
| 1562 | ||||||||||||||||||
695 | } | - | ||||||||||||||||||
696 | - | |||||||||||||||||||
697 | void QQuickDrag::setActive(bool drag) | - | ||||||||||||||||||
698 | { | - | ||||||||||||||||||
699 | if (_active == drag
| 88-120 | ||||||||||||||||||
700 | return; executed 88 times by 4 tests: return; Executed by:
| 88 | ||||||||||||||||||
701 | _active = drag; | - | ||||||||||||||||||
702 | activeChanged(); | - | ||||||||||||||||||
703 | } executed 120 times by 4 tests: end of block Executed by:
| 120 | ||||||||||||||||||
704 | - | |||||||||||||||||||
705 | bool QQuickDrag::filterChildren() const | - | ||||||||||||||||||
706 | { | - | ||||||||||||||||||
707 | return executed 44 times by 2 tests: _filterChildren;return _filterChildren; Executed by:
executed 44 times by 2 tests: return _filterChildren; Executed by:
| 44 | ||||||||||||||||||
708 | } | - | ||||||||||||||||||
709 | - | |||||||||||||||||||
710 | void QQuickDrag::setFilterChildren(bool filter) | - | ||||||||||||||||||
711 | { | - | ||||||||||||||||||
712 | if (_filterChildren == filter
| 2-18 | ||||||||||||||||||
713 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||
714 | _filterChildren = filter; | - | ||||||||||||||||||
715 | filterChildrenChanged(); | - | ||||||||||||||||||
716 | } executed 18 times by 3 tests: end of block Executed by:
| 18 | ||||||||||||||||||
717 | - | |||||||||||||||||||
718 | QQuickDragAttached *QQuickDrag::qmlAttachedProperties(QObject *obj) | - | ||||||||||||||||||
719 | { | - | ||||||||||||||||||
720 | return executed 390 times by 4 tests: new QQuickDragAttached(obj);return new QQuickDragAttached(obj); Executed by:
executed 390 times by 4 tests: return new QQuickDragAttached(obj); Executed by:
| 390 | ||||||||||||||||||
721 | } | - | ||||||||||||||||||
722 | - | |||||||||||||||||||
723 | - | |||||||||||||||||||
724 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |