OpenCoverage

qquickmousearea.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickmousearea.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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#include "qquickmousearea_p.h"-
41#include "qquickmousearea_p_p.h"-
42#include "qquickwindow.h"-
43#include "qquickdrag_p.h"-
44-
45#include <private/qqmldata_p.h>-
46#include <private/qsgadaptationlayer_p.h>-
47-
48#include <QtGui/private/qguiapplication_p.h>-
49#include <QtGui/qevent.h>-
50#include <QtGui/qstylehints.h>-
51-
52#include <float.h>-
53-
54QT_BEGIN_NAMESPACE-
55-
56DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING)
never executed: status = Yes;
never executed: end of block
executed 46 times by 23 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
executed 2012 times by 23 tests: return status == Yes;
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
status == UnknownDescription
TRUEevaluated 46 times by 23 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
FALSEevaluated 1966 times by 19 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
__builtin_expe...ING")), false)Description
TRUEnever evaluated
FALSEevaluated 46 times by 23 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
v != "0"Description
TRUEnever evaluated
FALSEnever evaluated
v != "false"Description
TRUEnever evaluated
FALSEnever evaluated
0-2012
57-
58Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE)-
59-
60QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()-
61: enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false),-
62 moved(false), stealMouse(false), doubleClick(false), preventStealing(false),-
63 propagateComposedEvents(false), overThreshold(false), pressed(nullptr),-
64 pressAndHoldInterval(-1)-
65#if QT_CONFIG(draganddrop)-
66 , drag(nullptr)-
67#endif-
68#if QT_CONFIG(cursor)-
69 , cursor(nullptr)-
70#endif-
71{-
72}
executed 2012 times by 23 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
2012
73-
74QQuickMouseAreaPrivate::~QQuickMouseAreaPrivate()-
75{-
76#if QT_CONFIG(draganddrop)-
77 delete drag;-
78#endif-
79#if QT_CONFIG(cursor)-
80 delete cursor;-
81#endif-
82}
executed 1970 times by 21 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
1970
83-
84void QQuickMouseAreaPrivate::init()-
85{-
86 Q_Q(QQuickMouseArea);-
87 q->setAcceptedMouseButtons(Qt::LeftButton);-
88 q->setAcceptTouchEvents(false); // rely on mouse events synthesized from touch-
89 q->setFiltersChildMouseEvents(true);-
90 if (qmlVisualTouchDebugging()) {
qmlVisualTouchDebugging()Description
TRUEnever evaluated
FALSEevaluated 2012 times by 23 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
0-2012
91 q->setFlag(QQuickItem::ItemHasContents);-
92 }
never executed: end of block
0
93}
executed 2012 times by 23 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
2012
94-
95void QQuickMouseAreaPrivate::saveEvent(QMouseEvent *event)-
96{-
97 lastPos = event->localPos();-
98 lastScenePos = event->windowPos();-
99 lastButton = event->button();-
100 lastButtons = event->buttons();-
101 lastModifiers = event->modifiers();-
102 lastFlags = event->flags();-
103}
executed 953 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
953
104-
105bool QQuickMouseAreaPrivate::isPressAndHoldConnected()-
106{-
107 Q_Q(QQuickMouseArea);-
108 IS_SIGNAL_CONNECTED(q, QQuickMouseArea, pressAndHold, (QQuickMouseEvent *));
executed 26 times by 1 test: return QObjectPrivate::get(sender)->isSignalConnected(signalIdx);
Executed by:
  • tst_qquickmousearea
26
109}-
110-
111bool QQuickMouseAreaPrivate::isDoubleClickConnected()-
112{-
113 Q_Q(QQuickMouseArea);-
114 IS_SIGNAL_CONNECTED(q, QQuickMouseArea, doubleClicked, (QQuickMouseEvent *));
executed 80 times by 2 tests: return QObjectPrivate::get(sender)->isSignalConnected(signalIdx);
Executed by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
80
115}-
116-
117bool QQuickMouseAreaPrivate::isClickConnected()-
118{-
119 Q_Q(QQuickMouseArea);-
120 IS_SIGNAL_CONNECTED(q, QQuickMouseArea, clicked, (QQuickMouseEvent *));
executed 138 times by 4 tests: return QObjectPrivate::get(sender)->isSignalConnected(signalIdx);
Executed by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
138
121}-
122-
123bool QQuickMouseAreaPrivate::isWheelConnected()-
124{-
125 Q_Q(QQuickMouseArea);-
126 IS_SIGNAL_CONNECTED(q, QQuickMouseArea, wheel, (QQuickWheelEvent *));
executed 2 times by 1 test: return QObjectPrivate::get(sender)->isSignalConnected(signalIdx);
Executed by:
  • tst_qquickmousearea
2
127}-
128-
129void QQuickMouseAreaPrivate::propagate(QQuickMouseEvent* event, PropagateType t)-
130{-
131 Q_Q(QQuickMouseArea);-
132 if (!window || !propagateComposedEvents)
!windowDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 106 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
!propagateComposedEventsDescription
TRUEevaluated 86 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-106
133 return;
executed 88 times by 3 tests: return;
Executed by:
  • tst_qquickitem
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
88
134 QPointF scenePos = q->mapToScene(QPointF(event->x(), event->y()));-
135 propagateHelper(event, window->contentItem(), scenePos, t);-
136}
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
20
137-
138bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *item,const QPointF &sp, PropagateType sig)-
139{-
140 //Based off of QQuickWindow::deliverInitialMousePressEvent-
141 //But specific to MouseArea, so doesn't belong in window-
142 Q_Q(const QQuickMouseArea);-
143 QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);-
144-
145 if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) {
itemPrivate->f...hildrenToShapeDescription
TRUEnever evaluated
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-92
146 QPointF p = item->mapFromScene(sp);-
147 if (!item->contains(p))
!item->contains(p)Description
TRUEnever evaluated
FALSEnever evaluated
0
148 return false;
never executed: return false;
0
149 }
never executed: end of block
0
150-
151 QList<QQuickItem *> children = itemPrivate->paintOrderChildItems();-
152 for (int ii = children.count() - 1; ii >= 0; --ii) {
ii >= 0Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquickmousearea
52-72
153 QQuickItem *child = children.at(ii);-
154 if (!child->isVisible() || !child->isEnabled())
!child->isVisible()Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickmousearea
!child->isEnabled()Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-72
155 continue;
never executed: continue;
0
156 if (propagateHelper(ev, child, sp, sig))
propagateHelpe...hild, sp, sig)Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickmousearea
32-40
157 return true;
executed 40 times by 1 test: return true;
Executed by:
  • tst_qquickmousearea
40
158 }
executed 32 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
32
159-
160 QQuickMouseArea* ma = qobject_cast<QQuickMouseArea*>(item);-
161 if (ma && ma != q && ma->isEnabled() && itemPrivate->acceptedMouseButtons() & ev->button()) {
maDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickmousearea
ma != qDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmousearea
ma->isEnabled()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-40
162 switch (sig) {-
163 case Click:
executed 10 times by 1 test: case Click:
Executed by:
  • tst_qquickmousearea
10
164 if (!ma->d_func()->isClickConnected())
!ma->d_func()-...ickConnected()Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-10
165 return false;
never executed: return false;
0
166 break;
executed 10 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
10
167 case DoubleClick:
executed 4 times by 1 test: case DoubleClick:
Executed by:
  • tst_qquickmousearea
4
168 if (!ma->d_func()->isDoubleClickConnected())
!ma->d_func()-...ickConnected()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-4
169 return false;
never executed: return false;
0
170 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
4
171 case PressAndHold:
executed 4 times by 1 test: case PressAndHold:
Executed by:
  • tst_qquickmousearea
4
172 if (!ma->d_func()->isPressAndHoldConnected())
!ma->d_func()-...oldConnected()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-4
173 return false;
never executed: return false;
0
174 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
4
175 }-
176 QPointF p = item->mapFromScene(sp);-
177 if (item->contains(p)) {
item->contains(p)Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-18
178 ev->setX(p.x());-
179 ev->setY(p.y());-
180 ev->setAccepted(true);//It is connected, they have to explicitly ignore to let it slide-
181 switch (sig) {-
182 case Click: emit ma->clicked(ev); break;
executed 10 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
executed 10 times by 1 test: case Click:
Executed by:
  • tst_qquickmousearea
10
183 case DoubleClick: emit ma->doubleClicked(ev); break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
executed 4 times by 1 test: case DoubleClick:
Executed by:
  • tst_qquickmousearea
4
184 case PressAndHold: emit ma->pressAndHold(ev); break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
executed 4 times by 1 test: case PressAndHold:
Executed by:
  • tst_qquickmousearea
4
185 }-
186 if (ev->isAccepted())
ev->isAccepted()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-16
187 return true;
executed 16 times by 1 test: return true;
Executed by:
  • tst_qquickmousearea
16
188 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
2
189 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
2
190 return false;
executed 36 times by 1 test: return false;
Executed by:
  • tst_qquickmousearea
36
191-
192}-
193-
194/*!-
195 \qmltype MouseArea-
196 \instantiates QQuickMouseArea-
197 \inqmlmodule QtQuick-
198 \ingroup qtquick-input-
199 \brief Enables simple mouse handling.-
200 \inherits Item-
201-
202 A MouseArea is an invisible item that is typically used in conjunction with-
203 a visible item in order to provide mouse handling for that item.-
204 By effectively acting as a proxy, the logic for mouse handling can be-
205 contained within a MouseArea item.-
206-
207 The \l enabled property is used to enable and disable mouse handling for-
208 the proxied item. When disabled, the mouse area becomes transparent to-
209 mouse events.-
210-
211 MouseArea is an invisible Item, but it has a visible property.-
212 When set to false, the mouse area becomes transparent to mouse events.-
213-
214 The \l pressed read-only property indicates whether or not the user is-
215 holding down a mouse button over the mouse area. This property is often-
216 used in bindings between properties in a user interface. The containsMouse-
217 read-only property indicates the presence of the mouse cursor over the-
218 mouse area but, by default, only when a mouse button is held down; see-
219 the containsMouse documentation for details.-
220-
221 Information about the mouse position and button clicks are provided via-
222 signals for which event handler properties are defined. The most commonly-
223 used involved handling mouse presses and clicks: onClicked, onDoubleClicked,-
224 onPressed, onReleased and onPressAndHold. It's also possible to handle mouse-
225 wheel events via the onWheel signal.-
226-
227 If a MouseArea overlaps with the area of other MouseArea items, you can choose-
228 to propagate \c clicked, \c doubleClicked and \c pressAndHold events to these-
229 other items by setting propagateComposedEvents to true and rejecting events-
230 that should be propagated. See the propagateComposedEvents documentation for-
231 details.-
232-
233 By default, MouseArea items only report mouse clicks and not changes to the-
234 position of the mouse cursor. Setting the hoverEnabled property ensures that-
235 handlers defined for onPositionChanged, onEntered and onExited are used and-
236 that the containsMouse property is updated even when no mouse buttons are-
237 pressed.-
238-
239 \section1 Example Usage-
240-
241 \div {class="float-right"}-
242 \inlineimage qml-mousearea-snippet.png-
243 \enddiv-
244-
245 The following example uses a MouseArea in a \l Rectangle that changes-
246 the \l Rectangle color to red when clicked:-
247-
248 \snippet qml/mousearea/mousearea.qml import-
249 \codeline-
250 \snippet qml/mousearea/mousearea.qml intro-
251-
252 \clearfloat-
253 Many MouseArea signals pass a \l{MouseEvent}{mouse} parameter that contains-
254 additional information about the mouse event, such as the position, button,-
255 and any key modifiers.-
256-
257 Here is an extension of the previous example that produces a different-
258 color when the area is right clicked:-
259-
260 \snippet qml/mousearea/mousearea.qml intro-extended-
261-
262 \sa MouseEvent, {mousearea}{MouseArea example},-
263 {Important Concepts In Qt Quick - User Input}-
264*/-
265-
266/*!-
267 \qmlsignal QtQuick::MouseArea::entered()-
268-
269 This signal is emitted when the mouse enters the mouse area.-
270-
271 By default this signal is only emitted if a button is currently-
272 pressed. Set \l hoverEnabled to true to emit this signal-
273 even when no mouse button is pressed.-
274-
275 \sa hoverEnabled-
276-
277 The corresponding handler is \c onEntered.-
278*/-
279-
280/*!-
281 \qmlsignal QtQuick::MouseArea::exited()-
282-
283 This signal is emitted when the mouse exits the mouse area.-
284-
285 By default this signal is only emitted if a button is currently-
286 pressed. Set \l hoverEnabled to true to emit this signal-
287 even when no mouse button is pressed.-
288-
289 The example below shows a fairly typical relationship between-
290 two MouseAreas, with \c mouseArea2 on top of \c mouseArea1. Moving the-
291 mouse into \c mouseArea2 from \c mouseArea1 will cause \c mouseArea1-
292 to emit the \c exited signal.-
293 \qml-
294 Rectangle {-
295 width: 400; height: 400-
296 MouseArea {-
297 id: mouseArea1-
298 anchors.fill: parent-
299 hoverEnabled: true-
300 }-
301 MouseArea {-
302 id: mouseArea2-
303 width: 100; height: 100-
304 anchors.centerIn: parent-
305 hoverEnabled: true-
306 }-
307 }-
308 \endqml-
309-
310 If instead you give the two MouseAreas a parent-child relationship,-
311 moving the mouse into \c mouseArea2 from \c mouseArea1 will \b not-
312 cause \c mouseArea1 to emit \c exited. Instead, they will-
313 both be considered to be simultaneously hovered.-
314-
315 \sa hoverEnabled-
316-
317 The corresponding handler is \c onExited.-
318*/-
319-
320/*!-
321 \qmlsignal QtQuick::MouseArea::positionChanged(MouseEvent mouse)-
322-
323 This signal is emitted when the mouse position changes.-
324-
325 The \l {MouseEvent}{mouse} parameter provides information about the mouse, including the x and y-
326 position, and any buttons currently pressed.-
327-
328 By default this signal is only emitted if a button is currently-
329 pressed. Set \l hoverEnabled to true to emit this signal-
330 even when no mouse button is pressed.-
331-
332 When handling this signal, changing the \l {MouseEvent::}{accepted} property of the \a mouse-
333 parameter has no effect.-
334-
335 The corresponding handler is \c onPositionChanged.-
336*/-
337-
338/*!-
339 \qmlsignal QtQuick::MouseArea::clicked(MouseEvent mouse)-
340-
341 This signal is emitted when there is a click. A click is defined as a press followed by a release,-
342 both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and-
343 releasing is also considered a click).-
344-
345 The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y-
346 position of the release of the click, and whether the click was held.-
347-
348 When handling this signal, changing the \l {MouseEvent::}{accepted} property of the \a mouse-
349 parameter has no effect, unless the \l propagateComposedEvents property is \c true.-
350-
351 The corresponding handler is \c onClicked.-
352*/-
353-
354/*!-
355 \qmlsignal QtQuick::MouseArea::pressed(MouseEvent mouse)-
356-
357 This signal is emitted when there is a press.-
358 The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y-
359 position and which button was pressed.-
360-
361 When handling this signal, use the \l {MouseEvent::}{accepted} property of the \a mouse-
362 parameter to control whether this MouseArea handles the press and all future mouse events until-
363 release. The default is to accept the event and not allow other MouseAreas beneath this one to-
364 handle the event. If \e accepted is set to false, no further events will be sent to this MouseArea-
365 until the button is next pressed.-
366-
367 The corresponding handler is \c onPressed.-
368*/-
369-
370/*!-
371 \qmlsignal QtQuick::MouseArea::released(MouseEvent mouse)-
372-
373 This signal is emitted when there is a release.-
374 The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y-
375 position of the release of the click, and whether the click was held.-
376-
377 When handling this signal, changing the \l {MouseEvent::}{accepted} property of the \a mouse-
378 parameter has no effect.-
379-
380 The corresponding handler is \c onReleased.-
381-
382 \sa canceled-
383*/-
384-
385/*!-
386 \qmlsignal QtQuick::MouseArea::pressAndHold(MouseEvent mouse)-
387-
388 This signal is emitted when there is a long press (currently 800ms).-
389 The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y-
390 position of the press, and which button is pressed.-
391-
392 When handling this signal, changing the \l {MouseEvent::}{accepted} property of the \a mouse-
393 parameter has no effect, unless the \l propagateComposedEvents property is \c true.-
394-
395 The corresponding handler is \c onPressAndHold.-
396*/-
397-
398/*!-
399 \qmlsignal QtQuick::MouseArea::doubleClicked(MouseEvent mouse)-
400-
401 This signal is emitted when there is a double-click (a press followed by a release followed by a press).-
402 The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y-
403 position of the release of the click, and whether the click was held.-
404-
405 When handling this signal, if the \l {MouseEvent::}{accepted} property of the \a mouse-
406 parameter is set to false, the pressed/released/clicked signals will be emitted for the second-
407 click; otherwise they are suppressed. The \c accepted property defaults to true.-
408-
409 The corresponding handler is \c onDoubleClicked.-
410*/-
411-
412/*!-
413 \qmlsignal QtQuick::MouseArea::canceled()-
414-
415 This signal is emitted when mouse events have been canceled, because another item stole the mouse event handling.-
416-
417 This signal is for advanced use: it is useful when there is more than one MouseArea-
418 that is handling input, or when there is a MouseArea inside a \l Flickable. In the latter-
419 case, if you execute some logic in the \c onPressed signal handler and then start dragging, the-
420 \l Flickable will steal the mouse handling from the MouseArea. In these cases, to reset-
421 the logic when the MouseArea has lost the mouse handling to the \l Flickable,-
422 \c canceled should be handled in addition to \l released.-
423-
424 The corresponding handler is \c onCanceled.-
425*/-
426-
427/*!-
428 \qmlsignal QtQuick::MouseArea::wheel(WheelEvent wheel)-
429-
430 This signal is emitted in response to both mouse wheel and trackpad scroll gestures.-
431-
432 The \l {WheelEvent}{wheel} parameter provides information about the event, including the x and y-
433 position, any buttons currently pressed, and information about the wheel movement, including-
434 angleDelta and pixelDelta.-
435-
436 The corresponding handler is \c onWheel.-
437*/-
438-
439QQuickMouseArea::QQuickMouseArea(QQuickItem *parent)-
440 : QQuickItem(*(new QQuickMouseAreaPrivate), parent)-
441{-
442 Q_D(QQuickMouseArea);-
443 d->init();-
444#if QT_CONFIG(cursor)-
445 // Explcitly call setCursor on QQuickItem since-
446 // it internally keeps a boolean hasCursor that doesn't-
447 // get set to true unless you call setCursor-
448 setCursor(Qt::ArrowCursor);-
449#endif-
450}
executed 2012 times by 23 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
2012
451-
452QQuickMouseArea::~QQuickMouseArea()-
453{-
454}-
455-
456/*!-
457 \qmlproperty real QtQuick::MouseArea::mouseX-
458 \qmlproperty real QtQuick::MouseArea::mouseY-
459 These properties hold the coordinates of the mouse cursor.-
460-
461 If the hoverEnabled property is false then these properties will only be valid-
462 while a button is pressed, and will remain valid as long as the button is held-
463 down even if the mouse is moved outside the area.-
464-
465 By default, this property is false.-
466-
467 If hoverEnabled is true then these properties will be valid when:-
468 \list-
469 \li no button is pressed, but the mouse is within the MouseArea (containsMouse is true).-
470 \li a button is pressed and held, even if it has since moved out of the area.-
471 \endlist-
472-
473 The coordinates are relative to the MouseArea.-
474*/-
475qreal QQuickMouseArea::mouseX() const-
476{-
477 Q_D(const QQuickMouseArea);-
478 return d->lastPos.x();
executed 64 times by 3 tests: return d->lastPos.x();
Executed by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
64
479}-
480-
481qreal QQuickMouseArea::mouseY() const-
482{-
483 Q_D(const QQuickMouseArea);-
484 return d->lastPos.y();
executed 64 times by 3 tests: return d->lastPos.y();
Executed by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
64
485}-
486-
487/*!-
488 \qmlproperty bool QtQuick::MouseArea::enabled-
489 This property holds whether the item accepts mouse events.-
490-
491 \note Due to historical reasons, this property is not equivalent to-
492 Item.enabled. It only affects mouse events, and its effect does not-
493 propagate to child items.-
494-
495 By default, this property is true.-
496*/-
497bool QQuickMouseArea::isEnabled() const-
498{-
499 Q_D(const QQuickMouseArea);-
500 return d->enabled;
executed 48 times by 2 tests: return d->enabled;
Executed by:
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
48
501}-
502-
503void QQuickMouseArea::setEnabled(bool a)-
504{-
505 Q_D(QQuickMouseArea);-
506 if (a != d->enabled) {
a != d->enabledDescription
TRUEevaluated 112 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquickmousearea
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickmousearea
10-112
507 d->enabled = a;-
508 emit enabledChanged();-
509 }
executed 112 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquickmousearea
112
510}
executed 122 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquickmousearea
122
511-
512/*!-
513 \qmlproperty bool QtQuick::MouseArea::scrollGestureEnabled-
514 \since 5.5-
515-
516 This property controls whether this MouseArea responds to scroll gestures-
517 from non-mouse devices, such as the 2-finger flick gesture on a trackpad.-
518 If set to false, the \l wheel signal be emitted only when the wheel event-
519 comes from an actual mouse with a wheel, while scroll gesture events will-
520 pass through to any other Item that will handle them. For example, the user-
521 might perform a flick gesture while the cursor is over an item containing a-
522 MouseArea, intending to interact with a Flickable which is underneath.-
523 Setting this property to false will allow the PinchArea to handle the mouse-
524 wheel or the pinch gesture, while the Flickable handles the flick gesture.-
525-
526 By default, this property is true.-
527*/-
528bool QQuickMouseArea::isScrollGestureEnabled() const-
529{-
530 Q_D(const QQuickMouseArea);-
531 return d->scrollGestureEnabled;
executed 26 times by 2 tests: return d->scrollGestureEnabled;
Executed by:
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
26
532}-
533-
534void QQuickMouseArea::setScrollGestureEnabled(bool e)-
535{-
536 Q_D(QQuickMouseArea);-
537 if (e != d->scrollGestureEnabled) {
e != d->scrollGestureEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
538 d->scrollGestureEnabled = e;-
539 emit scrollGestureEnabledChanged();-
540 }
never executed: end of block
0
541}
never executed: end of block
0
542-
543/*!-
544 \qmlproperty bool QtQuick::MouseArea::preventStealing-
545 This property holds whether the mouse events may be stolen from this-
546 MouseArea.-
547-
548 If a MouseArea is placed within an item that filters child mouse-
549 events, such as Flickable, the mouse-
550 events may be stolen from the MouseArea if a gesture is recognized-
551 by the parent item, e.g. a flick gesture. If preventStealing is-
552 set to true, no item will steal the mouse events.-
553-
554 Note that setting preventStealing to true once an item has started-
555 stealing events will have no effect until the next press event.-
556-
557 By default this property is false.-
558*/-
559bool QQuickMouseArea::preventStealing() const-
560{-
561 Q_D(const QQuickMouseArea);-
562 return d->preventStealing;
executed 24 times by 1 test: return d->preventStealing;
Executed by:
  • tst_qqmlenginedebugservice
24
563}-
564-
565void QQuickMouseArea::setPreventStealing(bool prevent)-
566{-
567 Q_D(QQuickMouseArea);-
568 if (prevent != d->preventStealing) {
prevent != d->preventStealingDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-6
569 d->preventStealing = prevent;-
570 setKeepMouseGrab(d->preventStealing && d->enabled);-
571 emit preventStealingChanged();-
572 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
6
573}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
8
574-
575-
576/*!-
577 \qmlproperty bool QtQuick::MouseArea::propagateComposedEvents-
578 This property holds whether composed mouse events will automatically propagate to-
579 other MouseAreas that overlap with this MouseArea but are lower in the visual stacking order.-
580 By default, this property is false.-
581-
582 MouseArea contains several composed events: \c clicked, \c doubleClicked and \c pressAndHold.-
583 These are composed of basic mouse events, like \c pressed, and can be propagated differently-
584 in comparison to basic events.-
585-
586 If propagateComposedEvents is set to true, then composed events will be automatically-
587 propagated to other MouseAreas in the same location in the scene. Each event is propagated-
588 to the next \l enabled MouseArea beneath it in the stacking order, propagating down this visual-
589 hierarchy until a MouseArea accepts the event. Unlike \c pressed events, composed events will-
590 not be automatically accepted if no handler is present.-
591-
592 For example, below is a yellow \l Rectangle that contains a blue \l Rectangle. The blue-
593 rectangle is the top-most item in the hierarchy of the visual stacking order; it will-
594 visually rendered above the yellow rectangle. Since the blue rectangle sets-
595 propagateComposedEvents to true, and also sets \l MouseEvent::accepted to false for all-
596 received \c clicked events, any \c clicked events it receives are propagated to the-
597 MouseArea of the yellow rectangle beneath it.-
598-
599 \qml-
600 import QtQuick 2.0-
601-
602 Rectangle {-
603 color: "yellow"-
604 width: 100; height: 100-
605-
606 MouseArea {-
607 anchors.fill: parent-
608 onClicked: console.log("clicked yellow")-
609 }-
610-
611 Rectangle {-
612 color: "blue"-
613 width: 50; height: 50-
614-
615 MouseArea {-
616 anchors.fill: parent-
617 propagateComposedEvents: true-
618 onClicked: {-
619 console.log("clicked blue")-
620 mouse.accepted = false-
621 }-
622 }-
623 }-
624 }-
625 \endqml-
626-
627 Clicking on the blue rectangle will cause the \c onClicked handler of its child MouseArea to-
628 be invoked; the event will then be propagated to the MouseArea of the yellow rectangle, causing-
629 its own \c onClicked handler to be invoked.-
630-
631 This property greatly simplifies the usecase of when you want to have overlapping MouseAreas-
632 handling the composed events together. For example: if you want one MouseArea to handle \c clicked-
633 signals and the other to handle \c pressAndHold, or if you want one MouseArea to handle \c clicked most-
634 of the time, but pass it through when certain conditions are met.-
635*/-
636bool QQuickMouseArea::propagateComposedEvents() const-
637{-
638 Q_D(const QQuickMouseArea);-
639 return d->propagateComposedEvents;
executed 24 times by 1 test: return d->propagateComposedEvents;
Executed by:
  • tst_qqmlenginedebugservice
24
640}-
641-
642void QQuickMouseArea::setPropagateComposedEvents(bool prevent)-
643{-
644 Q_D(QQuickMouseArea);-
645 if (prevent != d->propagateComposedEvents) {
prevent != d->...ComposedEventsDescription
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-60
646 d->propagateComposedEvents = prevent;-
647 setKeepMouseGrab(d->propagateComposedEvents && d->enabled);-
648 emit propagateComposedEventsChanged();-
649 }
executed 60 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
60
650}
executed 60 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
60
651-
652/*!-
653 \qmlproperty MouseButtons QtQuick::MouseArea::pressedButtons-
654 This property holds the mouse buttons currently pressed.-
655-
656 It contains a bitwise combination of:-
657 \list-
658 \li Qt.LeftButton-
659 \li Qt.RightButton-
660 \li Qt.MiddleButton-
661 \endlist-
662-
663 The code below displays "right" when the right mouse buttons is pressed:-
664-
665 \snippet qml/mousearea/mousearea.qml mousebuttons-
666-
667 \note this property only handles buttons specified in \l acceptedButtons.-
668-
669 \sa acceptedButtons-
670*/-
671Qt::MouseButtons QQuickMouseArea::pressedButtons() const-
672{-
673 Q_D(const QQuickMouseArea);-
674 return d->pressed;
executed 60 times by 3 tests: return d->pressed;
Executed by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
60
675}-
676-
677void QQuickMouseArea::mousePressEvent(QMouseEvent *event)-
678{-
679 Q_D(QQuickMouseArea);-
680 d->moved = false;-
681 d->stealMouse = d->preventStealing;-
682 d->overThreshold = false;-
683 if (!d->enabled || !(event->button() & acceptedMouseButtons())) {
!d->enabledDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickmousearea
FALSEevaluated 292 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
!(event->butto...ouseButtons())Description
TRUEnever evaluated
FALSEevaluated 292 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
0-292
684 QQuickItem::mousePressEvent(event);-
685 } else {
executed 98 times by 2 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickmousearea
98
686 d->longPress = false;-
687 d->saveEvent(event);-
688#if QT_CONFIG(draganddrop)-
689 if (d->drag)
d->dragDescription
TRUEevaluated 80 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 212 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
80-212
690 d->drag->setActive(false);
executed 80 times by 4 tests: d->drag->setActive(false);
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
80
691#endif-
692 setHovered(true);-
693 d->startScene = event->windowPos();-
694 setKeepMouseGrab(d->stealMouse);-
695 event->setAccepted(setPressed(event->button(), true, event->source()));-
696 if (event->isAccepted())
event->isAccepted()Description
TRUEevaluated 276 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmousearea
16-276
697 d->pressAndHoldTimer.start(pressAndHoldInterval(), this);
executed 276 times by 6 tests: d->pressAndHoldTimer.start(pressAndHoldInterval(), this);
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
276
698 }
executed 292 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
292
699}-
700-
701void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)-
702{-
703 Q_D(QQuickMouseArea);-
704 if (!d->enabled && !d->pressed) {
!d->enabledDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 397 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
!d->pressedDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-397
705 QQuickItem::mouseMoveEvent(event);-
706 return;
never executed: return;
0
707 }-
708-
709 d->saveEvent(event);-
710-
711 // ### we should skip this if these signals aren't used-
712 // ### can GV handle this for us?-
713 setHovered(contains(d->lastPos));-
714-
715#if QT_CONFIG(draganddrop)-
716 if (d->drag && d->drag->target()) {
d->dragDescription
TRUEevaluated 338 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 63 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
d->drag->target()Description
TRUEevaluated 338 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEnever evaluated
0-338
717 if (!d->moved) {
!d->movedDescription
TRUEevaluated 82 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 256 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
82-256
718 d->targetStartPos = d->drag->target()->parentItem()
d->drag->targe...->parentItem()Description
TRUEevaluated 82 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEnever evaluated
0-82
719 ? d->drag->target()->parentItem()->mapToScene(d->drag->target()->position())-
720 : d->drag->target()->position();-
721 }
executed 82 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
82
722-
723 QPointF startLocalPos;-
724 QPointF curLocalPos;-
725 if (drag()->target()->parentItem()) {
drag()->target()->parentItem()Description
TRUEevaluated 338 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEnever evaluated
0-338
726 startLocalPos = drag()->target()->parentItem()->mapFromScene(d->startScene);-
727 curLocalPos = drag()->target()->parentItem()->mapFromScene(event->windowPos());-
728 } else {
executed 338 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
338
729 startLocalPos = d->startScene;-
730 curLocalPos = event->windowPos();-
731 }
never executed: end of block
0
732-
733 if (keepMouseGrab() && d->stealMouse && d->overThreshold && !d->drag->active())
keepMouseGrab()Description
TRUEevaluated 232 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 106 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
d->stealMouseDescription
TRUEevaluated 232 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEnever evaluated
d->overThresholdDescription
TRUEevaluated 220 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickmousearea
!d->drag->active()Description
TRUEevaluated 60 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 160 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
0-232
734 d->drag->setActive(true);
executed 60 times by 4 tests: d->drag->setActive(true);
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
60
735-
736 QPointF startPos = d->drag->target()->parentItem()
d->drag->targe...->parentItem()Description
TRUEevaluated 338 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEnever evaluated
0-338
737 ? d->drag->target()->parentItem()->mapFromScene(d->targetStartPos)-
738 : d->targetStartPos;-
739-
740 bool dragX = drag()->axis() & QQuickDrag::XAxis;-
741 bool dragY = drag()->axis() & QQuickDrag::YAxis;-
742-
743 QPointF dragPos = d->drag->target()->position();-
744 QPointF boundedDragPos = dragPos;-
745 if (dragX) {
dragXDescription
TRUEevaluated 324 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
14-324
746 dragPos.setX(startPos.x() + curLocalPos.x() - startLocalPos.x());-
747 boundedDragPos.setX(qBound(-
748 d->drag->xmin(),-
749 dragPos.x(),-
750 d->drag->xmax()));-
751 }
executed 324 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
324
752 if (dragY) {
dragYDescription
TRUEevaluated 318 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmousearea
20-318
753 dragPos.setY(startPos.y() + curLocalPos.y() - startLocalPos.y());-
754 boundedDragPos.setY(qBound(-
755 d->drag->ymin(),-
756 dragPos.y(),-
757 d->drag->ymax()));-
758 }
executed 318 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
318
759-
760 QPointF targetPos = d->drag->target()->position();-
761-
762 if (d->drag->active())
d->drag->active()Description
TRUEevaluated 220 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 118 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
118-220
763 d->drag->target()->setPosition(boundedDragPos);
executed 220 times by 4 tests: d->drag->target()->setPosition(boundedDragPos);
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
220
764-
765 bool dragOverThresholdX = QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(),-
766 Qt::XAxis, event, d->drag->threshold());-
767 bool dragOverThresholdY = QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(),-
768 Qt::YAxis, event, d->drag->threshold());-
769-
770 if (!d->overThreshold && (((targetPos.x() != boundedDragPos.x()) && dragOverThresholdX) ||
!d->overThresholdDescription
TRUEevaluated 118 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 220 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
(targetPos.x()...edDragPos.x())Description
TRUEevaluated 48 times by 3 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 70 times by 3 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
dragOverThresholdXDescription
TRUEevaluated 40 times by 3 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquicklistview
8-220
771 ((targetPos.y() != boundedDragPos.y()) && dragOverThresholdY)))
(targetPos.y()...edDragPos.y())Description
TRUEevaluated 54 times by 2 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickmousearea
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
dragOverThresholdYDescription
TRUEevaluated 34 times by 2 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickmousearea
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmousearea
20-54
772 {-
773 d->overThreshold = true;-
774 if (d->drag->smoothed())
d->drag->smoothed()Description
TRUEevaluated 72 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-72
775 d->startScene = event->windowPos();
executed 72 times by 4 tests: d->startScene = event->windowPos();
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
72
776 }
executed 74 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
74
777-
778 if (!keepMouseGrab() && d->overThreshold) {
!keepMouseGrab()Description
TRUEevaluated 106 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 232 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
d->overThresholdDescription
TRUEevaluated 70 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
36-232
779 setKeepMouseGrab(true);-
780 d->stealMouse = true;-
781 }
executed 70 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
70
782-
783 d->moved = true;-
784 }
executed 338 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
338
785#endif-
786-
787 QQuickMouseEvent &me = d->quickMouseEvent;-
788 me.reset(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress, event->flags());-
789 me.setSource(event->source());-
790 emit mouseXChanged(&me);-
791 me.setPosition(d->lastPos);-
792 emit mouseYChanged(&me);-
793 me.setPosition(d->lastPos);-
794 emit positionChanged(&me);-
795}
executed 401 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
401
796-
797void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event)-
798{-
799 Q_D(QQuickMouseArea);-
800 d->stealMouse = false;-
801 d->overThreshold = false;-
802 if (!d->enabled && !d->pressed) {
!d->enabledDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 220 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
!d->pressedDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-220
803 QQuickItem::mouseReleaseEvent(event);-
804 } else {
never executed: end of block
0
805 d->saveEvent(event);-
806 setPressed(event->button(), false, event->source());-
807 if (!d->pressed) {
!d->pressedDescription
TRUEevaluated 220 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-220
808 // no other buttons are pressed-
809#if QT_CONFIG(draganddrop)-
810 if (d->drag)
d->dragDescription
TRUEevaluated 58 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 162 times by 4 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
58-162
811 d->drag->setActive(false);
executed 58 times by 4 tests: d->drag->setActive(false);
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
58
812#endif-
813 // If we don't accept hover, we need to reset containsMouse.-
814 if (!acceptHoverEvents())
!acceptHoverEvents()Description
TRUEevaluated 208 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickmousearea
12-208
815 setHovered(false);
executed 208 times by 6 tests: setHovered(false);
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
208
816 QQuickWindow *w = window();-
817 if (w && w->mouseGrabberItem() == this)
wDescription
TRUEevaluated 218 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
w->mouseGrabberItem() == thisDescription
TRUEevaluated 218 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEnever evaluated
0-218
818 ungrabMouse();
executed 218 times by 6 tests: ungrabMouse();
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
218
819 setKeepMouseGrab(false);-
820 }
executed 220 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
220
821 }
executed 222 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
222
822 d->doubleClick = false;-
823}
executed 222 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
222
824-
825void QQuickMouseArea::mouseDoubleClickEvent(QMouseEvent *event)-
826{-
827 Q_D(QQuickMouseArea);-
828 if (d->enabled) {
d->enabledDescription
TRUEevaluated 38 times by 2 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEnever evaluated
0-38
829 d->saveEvent(event);-
830 QQuickMouseEvent &me = d->quickMouseEvent;-
831 me.reset(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true,-
832 false, event->flags());-
833 me.setSource(event->source());-
834 me.setAccepted(d->isDoubleClickConnected());-
835 emit this->doubleClicked(&me);-
836 if (!me.isAccepted())
!me.isAccepted()Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmousearea
16-22
837 d->propagate(&me, QQuickMouseAreaPrivate::DoubleClick);
executed 22 times by 2 tests: d->propagate(&me, QQuickMouseAreaPrivate::DoubleClick);
Executed by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
22
838 d->doubleClick = d->isDoubleClickConnected() || me.isAccepted();
d->isDoubleClickConnected()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
me.isAccepted()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
2-20
839 }
executed 38 times by 2 tests: end of block
Executed by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
38
840 QQuickItem::mouseDoubleClickEvent(event);-
841}
executed 38 times by 2 tests: end of block
Executed by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
38
842-
843void QQuickMouseArea::hoverEnterEvent(QHoverEvent *event)-
844{-
845 Q_D(QQuickMouseArea);-
846 if (!d->enabled && !d->pressed) {
!d->enabledDescription
TRUEnever evaluated
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquicktext
  • tst_qquickwidget
!d->pressedDescription
TRUEnever evaluated
FALSEnever evaluated
0-24
847 QQuickItem::hoverEnterEvent(event);-
848 } else {
never executed: end of block
0
849 d->lastPos = event->posF();-
850 d->lastModifiers = event->modifiers();-
851 setHovered(true);-
852 QQuickMouseEvent &me = d->quickMouseEvent;-
853 me.reset(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, Qt::NoButton, d->lastModifiers, false, false);-
854 emit mouseXChanged(&me);-
855 me.setPosition(d->lastPos);-
856 emit mouseYChanged(&me);-
857 me.setPosition(d->lastPos);-
858 }
executed 24 times by 3 tests: end of block
Executed by:
  • tst_qquickmousearea
  • tst_qquicktext
  • tst_qquickwidget
24
859}-
860-
861void QQuickMouseArea::hoverMoveEvent(QHoverEvent *event)-
862{-
863 Q_D(QQuickMouseArea);-
864 if (!d->enabled && !d->pressed) {
!d->enabledDescription
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquicktext
  • tst_qquickwidget
!d->pressedDescription
TRUEnever evaluated
FALSEnever evaluated
0-12
865 QQuickItem::hoverMoveEvent(event);-
866 } else if (d->lastPos != event->posF()) {
never executed: end of block
d->lastPos != event->posF()Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickwidget
0-10
867 d->lastPos = event->posF();-
868 d->lastModifiers = event->modifiers();-
869 QQuickMouseEvent &me = d->quickMouseEvent;-
870 me.reset(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, Qt::NoButton, d->lastModifiers, false, false);-
871 emit mouseXChanged(&me);-
872 me.setPosition(d->lastPos);-
873 emit mouseYChanged(&me);-
874 me.setPosition(d->lastPos);-
875 emit positionChanged(&me);-
876 }
executed 10 times by 2 tests: end of block
Executed by:
  • tst_qquickmousearea
  • tst_qquicktext
10
877}
executed 12 times by 3 tests: end of block
Executed by:
  • tst_qquickmousearea
  • tst_qquicktext
  • tst_qquickwidget
12
878-
879void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event)-
880{-
881 Q_D(QQuickMouseArea);-
882 if (!d->enabled && !d->pressed)
!d->enabledDescription
TRUEnever evaluated
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquickwidget
!d->pressedDescription
TRUEnever evaluated
FALSEnever evaluated
0-10
883 QQuickItem::hoverLeaveEvent(event);
never executed: QQuickItem::hoverLeaveEvent(event);
0
884 else-
885 setHovered(false);
executed 10 times by 2 tests: setHovered(false);
Executed by:
  • tst_qquickmousearea
  • tst_qquickwidget
10
886}-
887-
888#if QT_CONFIG(wheelevent)-
889void QQuickMouseArea::wheelEvent(QWheelEvent *event)-
890{-
891 Q_D(QQuickMouseArea);-
892 if (!d->enabled || (!isScrollGestureEnabled() && event->source() != Qt::MouseEventNotSynthesized)) {
!d->enabledDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
!isScrollGestureEnabled()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
event->source(...NotSynthesizedDescription
TRUEnever evaluated
FALSEnever evaluated
0-2
893 QQuickItem::wheelEvent(event);-
894 return;
never executed: return;
0
895 }-
896-
897 QQuickWheelEvent &we = d->quickWheelEvent;-
898 we.reset(event->posF().x(), event->posF().y(), event->angleDelta(), event->pixelDelta(),-
899 event->buttons(), event->modifiers(), event->inverted());-
900 we.setAccepted(d->isWheelConnected());-
901 emit wheel(&we);-
902 if (!we.isAccepted())
!we.isAccepted()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-2
903 QQuickItem::wheelEvent(event);
never executed: QQuickItem::wheelEvent(event);
0
904}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
2
905#endif-
906-
907void QQuickMouseArea::ungrabMouse()-
908{-
909 Q_D(QQuickMouseArea);-
910 if (d->pressed) {
d->pressedDescription
TRUEevaluated 40 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 426 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
40-426
911 // if our mouse grab has been removed (probably by Flickable), fix our-
912 // state-
913 d->pressed = Qt::NoButton;-
914 d->stealMouse = false;-
915 d->doubleClick = false;-
916 d->overThreshold = false;-
917 setKeepMouseGrab(false);-
918-
919#if QT_CONFIG(draganddrop)-
920 if (d->drag)
d->dragDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 30 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
10-30
921 d->drag->setActive(false);
executed 10 times by 1 test: d->drag->setActive(false);
Executed by:
  • tst_qquickmousearea
10
922#endif-
923-
924 emit canceled();-
925 emit pressedChanged();-
926 emit containsPressChanged();-
927 emit pressedButtonsChanged();-
928-
929 if (d->hovered && !isUnderMouse()) {
d->hoveredDescription
TRUEevaluated 38 times by 3 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquicklistview
!isUnderMouse()Description
TRUEnever evaluated
FALSEevaluated 38 times by 3 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickmousearea
  • tst_qquickpathview
0-38
930 d->hovered = false;-
931 emit hoveredChanged();-
932 }
never executed: end of block
0
933 }
executed 40 times by 4 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
40
934}
executed 466 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
466
935-
936void QQuickMouseArea::mouseUngrabEvent()-
937{-
938 ungrabMouse();-
939}
executed 248 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
248
940-
941bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event)-
942{-
943 Q_D(QQuickMouseArea);-
944 QPointF localPos = mapFromScene(event->windowPos());-
945-
946 QQuickWindow *c = window();-
947 QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 86 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-86
948 bool stealThisEvent = d->stealMouse;-
949 if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) {
stealThisEventDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquickmousearea
contains(localPos)Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
!grabberDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquickmousearea
!grabber->keepMouseGrab()Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-62
950 QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(),-
951 event->button(), event->buttons(), event->modifiers());-
952 mouseEvent.setAccepted(false);-
953-
954 switch (event->type()) {-
955 case QEvent::MouseMove:
executed 38 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquickmousearea
38
956 mouseMoveEvent(&mouseEvent);-
957 break;
executed 38 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
38
958 case QEvent::MouseButtonPress:
executed 24 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquickmousearea
24
959 mousePressEvent(&mouseEvent);-
960 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
24
961 case QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
0
962 mouseReleaseEvent(&mouseEvent);-
963 stealThisEvent = d->stealMouse;-
964 break;
never executed: break;
0
965 default:
never executed: default:
0
966 break;
never executed: break;
0
967 }-
968 grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-62
969 if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this)
grabberDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickmousearea
stealThisEventDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickmousearea
!grabber->keepMouseGrab()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
grabber != thisDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-38
970 grabMouse();
executed 10 times by 1 test: grabMouse();
Executed by:
  • tst_qquickmousearea
10
971-
972 return stealThisEvent;
executed 62 times by 1 test: return stealThisEvent;
Executed by:
  • tst_qquickmousearea
62
973 }-
974 if (event->type() == QEvent::MouseButtonRelease) {
event->type() ...eButtonReleaseDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
10-14
975 if (d->pressed) {
d->pressedDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-14
976 d->pressed &= ~event->button();-
977 emit pressedButtonsChanged();-
978 if (!d->pressed) {
!d->pressedDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-14
979 // no other buttons are pressed-
980 d->stealMouse = false;-
981 d->overThreshold = false;-
982 if (c && c->mouseGrabberItem() == this)
cDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
c->mouseGrabberItem() == thisDescription
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-14
983 ungrabMouse();
never executed: ungrabMouse();
0
984 emit canceled();-
985 emit pressedChanged();-
986 emit containsPressChanged();-
987 if (d->hovered) {
d->hoveredDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-14
988 d->hovered = false;-
989 emit hoveredChanged();-
990 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
14
991 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
14
992 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
14
993 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
14
994 return false;
executed 24 times by 1 test: return false;
Executed by:
  • tst_qquickmousearea
24
995}-
996-
997bool QQuickMouseArea::childMouseEventFilter(QQuickItem *i, QEvent *e)-
998{-
999 Q_D(QQuickMouseArea);-
1000 if (!d->pressed &&
!d->pressedDescription
TRUEevaluated 102 times by 3 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickmousearea
80-102
1001 (!d->enabled || !isVisible()
!d->enabledDescription
TRUEnever evaluated
FALSEevaluated 102 times by 3 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
!isVisible()Description
TRUEnever evaluated
FALSEevaluated 102 times by 3 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
0-102
1002#if QT_CONFIG(draganddrop)-
1003 || !d->drag || !d->drag->filterChildren()
!d->dragDescription
TRUEevaluated 60 times by 2 tests
Evaluated by:
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
!d->drag->filterChildren()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquicklistview
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickmousearea
4-60
1004#endif-
1005 )-
1006 )-
1007 return QQuickItem::childMouseEventFilter(i, e);
executed 64 times by 3 tests: return QQuickItem::childMouseEventFilter(i, e);
Executed by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
64
1008 switch (e->type()) {-
1009 case QEvent::MouseButtonPress:
executed 24 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquickmousearea
24
1010 case QEvent::MouseMove:
executed 48 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquickmousearea
48
1011 case QEvent::MouseButtonRelease:
executed 14 times by 1 test: case QEvent::MouseButtonRelease:
Executed by:
  • tst_qquickmousearea
14
1012 return sendMouseEvent(static_cast<QMouseEvent *>(e));
executed 86 times by 1 test: return sendMouseEvent(static_cast<QMouseEvent *>(e));
Executed by:
  • tst_qquickmousearea
86
1013 default:
executed 32 times by 1 test: default:
Executed by:
  • tst_qquickmousearea
32
1014 break;
executed 32 times by 1 test: break;
Executed by:
  • tst_qquickmousearea
32
1015 }-
1016-
1017 return QQuickItem::childMouseEventFilter(i, e);
executed 32 times by 1 test: return QQuickItem::childMouseEventFilter(i, e);
Executed by:
  • tst_qquickmousearea
32
1018}-
1019-
1020void QQuickMouseArea::timerEvent(QTimerEvent *event)-
1021{-
1022 Q_D(QQuickMouseArea);-
1023 if (event->timerId() == d->pressAndHoldTimer.timerId()) {
event->timerId...imer.timerId()Description
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
FALSEnever evaluated
0-26
1024 d->pressAndHoldTimer.stop();-
1025#if QT_CONFIG(draganddrop)-
1026 bool dragged = d->drag && d->drag->active();
d->dragDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
d->drag->active()Description
TRUEnever evaluated
FALSEnever evaluated
0-26
1027#else-
1028 bool dragged = false;-
1029#endif-
1030 if (d->pressed && dragged == false && d->hovered == true) {
dragged == falseDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
d->hovered == trueDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-22
1031 d->longPress = true;-
1032 QQuickMouseEvent &me = d->quickMouseEvent;-
1033 me.reset(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress, d->lastFlags);-
1034 me.setSource(Qt::MouseEventSynthesizedByQt);-
1035 me.setAccepted(d->isPressAndHoldConnected());-
1036 emit pressAndHold(&me);-
1037 if (!me.isAccepted())
!me.isAccepted()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
10-12
1038 d->propagate(&me, QQuickMouseAreaPrivate::PressAndHold);
executed 12 times by 1 test: d->propagate(&me, QQuickMouseAreaPrivate::PressAndHold);
Executed by:
  • tst_qquickmousearea
12
1039 if (!me.isAccepted()) // no one handled the long press - allow click
!me.isAccepted()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
8-14
1040 d->longPress = false;
executed 8 times by 1 test: d->longPress = false;
Executed by:
  • tst_qquickmousearea
8
1041 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
22
1042 }
executed 26 times by 3 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
26
1043}
executed 26 times by 3 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
26
1044-
1045void QQuickMouseArea::windowDeactivateEvent()-
1046{-
1047 ungrabMouse();-
1048 QQuickItem::windowDeactivateEvent();-
1049}
never executed: end of block
0
1050-
1051void QQuickMouseArea::geometryChanged(const QRectF &newGeometry,-
1052 const QRectF &oldGeometry)-
1053{-
1054 Q_D(QQuickMouseArea);-
1055 QQuickItem::geometryChanged(newGeometry, oldGeometry);-
1056-
1057 if (d->lastScenePos.isNull)
d->lastScenePos.isNullDescription
TRUEevaluated 1992 times by 19 tests
Evaluated by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
FALSEevaluated 1226 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
1226-1992
1058 d->lastScenePos = mapToScene(d->lastPos);
executed 1992 times by 19 tests: d->lastScenePos = mapToScene(d->lastPos);
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
1992
1059 else if (newGeometry.x() != oldGeometry.x() || newGeometry.y() != oldGeometry.y())
newGeometry.x(...ldGeometry.x()Description
TRUEevaluated 216 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
FALSEevaluated 1010 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
newGeometry.y(...ldGeometry.y()Description
TRUEevaluated 116 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
FALSEevaluated 894 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_touchmouse
116-1010
1060 d->lastPos = mapFromScene(d->lastScenePos);
executed 332 times by 4 tests: d->lastPos = mapFromScene(d->lastScenePos);
Executed by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
332
1061}
executed 3218 times by 19 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
3218
1062-
1063void QQuickMouseArea::itemChange(ItemChange change, const ItemChangeData &value)-
1064{-
1065 Q_D(QQuickMouseArea);-
1066 switch (change) {-
1067 case ItemVisibleHasChanged:
executed 64 times by 4 tests: case ItemVisibleHasChanged:
Executed by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquickloader
  • tst_qquickmousearea
64
1068 if (acceptHoverEvents() && d->hovered != (isVisible() && isUnderMouse())) {
acceptHoverEvents()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 60 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquickloader
d->hovered != ...sUnderMouse())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
isVisible()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
isUnderMouse()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-60
1069 if (!d->hovered) {
!d->hoveredDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-2
1070 QPointF cursorPos = QGuiApplicationPrivate::lastCursorPosition;-
1071 d->lastScenePos = d->window->mapFromGlobal(cursorPos.toPoint());-
1072 d->lastPos = mapFromScene(d->lastScenePos);-
1073 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
2
1074 setHovered(!d->hovered);-
1075 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
2
1076 break;
executed 64 times by 4 tests: break;
Executed by:
  • tst_examples
  • tst_qquickflickable
  • tst_qquickloader
  • tst_qquickmousearea
64
1077 default:
executed 8206 times by 23 tests: default:
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
8206
1078 break;
executed 8206 times by 23 tests: break;
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
8206
1079 }-
1080-
1081 QQuickItem::itemChange(change, value);-
1082}
executed 8270 times by 23 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedsprite
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickstates
  • tst_qquicktext
  • tst_qquickwidget
  • tst_signalspy
  • tst_touchmouse
8270
1083-
1084/*!-
1085 \qmlproperty bool QtQuick::MouseArea::hoverEnabled-
1086 This property holds whether hover events are handled.-
1087-
1088 By default, mouse events are only handled in response to a button event, or when a button is-
1089 pressed. Hover enables handling of all mouse events even when no mouse button is-
1090 pressed.-
1091-
1092 This property affects the containsMouse property and the onEntered, onExited and-
1093 onPositionChanged signals.-
1094*/-
1095bool QQuickMouseArea::hoverEnabled() const-
1096{-
1097 return acceptHoverEvents();
executed 24 times by 1 test: return acceptHoverEvents();
Executed by:
  • tst_qqmlenginedebugservice
24
1098}-
1099-
1100void QQuickMouseArea::setHoverEnabled(bool h)-
1101{-
1102 if (h == acceptHoverEvents())
h == acceptHoverEvents()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 162 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickmousearea
  • tst_qquicktext
  • tst_qquickwidget
  • tst_touchmouse
2-162
1103 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickmousearea
2
1104-
1105 setAcceptHoverEvents(h);-
1106 emit hoverEnabledChanged();-
1107}
executed 162 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmousearea
  • tst_qquicktext
  • tst_qquickwidget
  • tst_touchmouse
162
1108-
1109-
1110/*!-
1111 \qmlproperty bool QtQuick::MouseArea::containsMouse-
1112 This property holds whether the mouse is currently inside the mouse area.-
1113-
1114 \warning If hoverEnabled is false, containsMouse will only be valid-
1115 when the mouse is pressed while the mouse cursor is inside the MouseArea.-
1116*/-
1117bool QQuickMouseArea::hovered() const-
1118{-
1119 Q_D(const QQuickMouseArea);-
1120 return d->hovered;
executed 224 times by 4 tests: return d->hovered;
Executed by:
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
  • tst_qquickwidget
  • tst_touchmouse
224
1121}-
1122-
1123/*!-
1124 \qmlproperty bool QtQuick::MouseArea::pressed-
1125 This property holds whether any of the \l acceptedButtons are currently pressed.-
1126*/-
1127bool QQuickMouseArea::pressed() const-
1128{-
1129 Q_D(const QQuickMouseArea);-
1130 return d->pressed;
executed 688 times by 8 tests: return d->pressed;
Executed by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickbehaviors
  • tst_qquickflickable
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickstates
  • tst_signalspy
688
1131}-
1132-
1133/*!-
1134 \qmlproperty bool QtQuick::MouseArea::containsPress-
1135 \since 5.4-
1136 This is a convenience property equivalent to \c {pressed && containsMouse},-
1137 i.e. it holds whether any of the \l acceptedButtons are currently pressed-
1138 and the mouse is currently within the MouseArea.-
1139-
1140 This property is particularly useful for highlighting an item while the mouse-
1141 is pressed within its bounds.-
1142-
1143 \sa pressed, containsMouse-
1144*/-
1145bool QQuickMouseArea::containsPress() const-
1146{-
1147 Q_D(const QQuickMouseArea);-
1148 return d->pressed && d->hovered;
executed 68 times by 2 tests: return d->pressed && d->hovered;
Executed by:
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
68
1149}-
1150-
1151void QQuickMouseArea::setHovered(bool h)-
1152{-
1153 Q_D(QQuickMouseArea);-
1154 if (d->hovered != h) {
d->hovered != hDescription
TRUEevaluated 510 times by 8 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquicktext
  • tst_qquickwidget
FALSEevaluated 427 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
427-510
1155 qCDebug(DBG_HOVER_TRACE) << this << d->hovered << "->" << h;
never executed: QMessageLogger(__FILE__, 1155, __PRETTY_FUNCTION__, DBG_HOVER_TRACE().categoryName()).debug() << this << d->hovered << "->" << h;
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 510 times by 8 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquicktext
  • tst_qquickwidget
0-510
1156 d->hovered = h;-
1157 emit hoveredChanged();-
1158 d->hovered ? emit entered() : emit exited();-
1159 if (d->pressed)
d->pressedDescription
TRUEevaluated 22 times by 3 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 488 times by 8 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquicktext
  • tst_qquickwidget
22-488
1160 emit containsPressChanged();
executed 22 times by 3 tests: containsPressChanged();
Executed by:
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
22
1161 }
executed 510 times by 8 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquicktext
  • tst_qquickwidget
510
1162}
executed 937 times by 8 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquicktext
  • tst_qquickwidget
937
1163-
1164/*!-
1165 \qmlproperty Qt::MouseButtons QtQuick::MouseArea::acceptedButtons-
1166 This property holds the mouse buttons that the mouse area reacts to.-
1167-
1168 To specify that the MouseArea will react to multiple buttons,-
1169 Qt::MouseButtons flag values are combined using the "|" (or) operator:-
1170-
1171 \code-
1172 MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton }-
1173 \endcode-
1174-
1175 To indicate that all possible mouse buttons are to be accepted,-
1176 the special value 'Qt.AllButtons' may be used:-
1177-
1178 \code-
1179 MouseArea { acceptedButtons: Qt.AllButtons }-
1180 \endcode-
1181-
1182 The default value is \c Qt.LeftButton.-
1183*/-
1184Qt::MouseButtons QQuickMouseArea::acceptedButtons() const-
1185{-
1186 return acceptedMouseButtons();
executed 24 times by 1 test: return acceptedMouseButtons();
Executed by:
  • tst_qqmlenginedebugservice
24
1187}-
1188-
1189void QQuickMouseArea::setAcceptedButtons(Qt::MouseButtons buttons)-
1190{-
1191 if (buttons != acceptedMouseButtons()) {
buttons != acc...MouseButtons()Description
TRUEevaluated 54 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquicktext
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickmousearea
16-54
1192 setAcceptedMouseButtons(buttons);-
1193 emit acceptedButtonsChanged();-
1194 }
executed 54 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquicktext
54
1195}
executed 70 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquicktext
70
1196-
1197bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventSource source)-
1198{-
1199 Q_D(QQuickMouseArea);-
1200-
1201#if QT_CONFIG(draganddrop)-
1202 bool dragged = d->drag && d->drag->active();
d->dragDescription
TRUEevaluated 138 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 376 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
d->drag->active()Description
TRUEevaluated 58 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 80 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
58-376
1203#else-
1204 bool dragged = false;-
1205#endif-
1206 bool wasPressed = d->pressed & button;-
1207 bool isclick = wasPressed && p == false && dragged == false && d->hovered == true;
wasPressedDescription
TRUEevaluated 228 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 286 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
p == falseDescription
TRUEevaluated 222 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmousearea
dragged == falseDescription
TRUEevaluated 164 times by 4 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 58 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
d->hovered == trueDescription
TRUEevaluated 162 times by 4 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-286
1208 Qt::MouseButtons oldPressed = d->pressed;-
1209-
1210 if (wasPressed != p) {
wasPressed != pDescription
TRUEevaluated 508 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickmousearea
6-508
1211 QQuickMouseEvent &me = d->quickMouseEvent;-
1212 me.reset(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress, d->lastFlags);-
1213 me.setSource(source);-
1214 if (p) {
pDescription
TRUEevaluated 286 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 222 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
222-286
1215 d->pressed |= button;-
1216 if (!d->doubleClick)
!d->doubleClickDescription
TRUEevaluated 286 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEnever evaluated
0-286
1217 emit pressed(&me);
executed 286 times by 6 tests: pressed(&me);
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
286
1218 me.setPosition(d->lastPos);-
1219 emit mouseXChanged(&me);-
1220 me.setPosition(d->lastPos);-
1221 emit mouseYChanged(&me);-
1222-
1223 if (!me.isAccepted()) {
!me.isAccepted()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 276 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
10-276
1224 d->pressed = Qt::NoButton;-
1225 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
10
1226-
1227 if (!oldPressed) {
!oldPressedDescription
TRUEevaluated 284 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-284
1228 emit pressedChanged();-
1229 emit containsPressChanged();-
1230 }
executed 284 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
284
1231 emit pressedButtonsChanged();-
1232 } else {
executed 286 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
286
1233 d->pressed &= ~button;-
1234 emit released(&me);-
1235 me.setPosition(d->lastPos);-
1236 if (!d->pressed) {
!d->pressedDescription
TRUEevaluated 220 times by 6 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-220
1237 emit pressedChanged();-
1238 emit containsPressChanged();-
1239 }
executed 220 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
220
1240 emit pressedButtonsChanged();-
1241 if (isclick && !d->longPress && !d->doubleClick){
isclickDescription
TRUEevaluated 162 times by 4 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 60 times by 4 tests
Evaluated by:
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
!d->longPressDescription
TRUEevaluated 148 times by 4 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickmousearea
!d->doubleClickDescription
TRUEevaluated 128 times by 4 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickmousearea
14-162
1242 me.setAccepted(d->isClickConnected());-
1243 emit clicked(&me);-
1244 if (!me.isAccepted())
!me.isAccepted()Description
TRUEevaluated 74 times by 3 tests
Evaluated by:
  • tst_qquickitem
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
FALSEevaluated 54 times by 2 tests
Evaluated by:
  • tst_qquicklistview
  • tst_qquickmousearea
54-74
1245 d->propagate(&me, QQuickMouseAreaPrivate::Click);
executed 74 times by 3 tests: d->propagate(&me, QQuickMouseAreaPrivate::Click);
Executed by:
  • tst_qquickitem
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
74
1246 }
executed 128 times by 4 tests: end of block
Executed by:
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
128
1247 }
executed 222 times by 6 tests: end of block
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
222
1248-
1249 return me.isAccepted();
executed 508 times by 6 tests: return me.isAccepted();
Executed by:
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
508
1250 }-
1251 return false;
executed 6 times by 1 test: return false;
Executed by:
  • tst_qquickmousearea
6
1252}-
1253-
1254-
1255/*!-
1256 \qmlproperty Qt::CursorShape QtQuick::MouseArea::cursorShape-
1257 This property holds the cursor shape for this mouse area.-
1258 Note that on platforms that do not display a mouse cursor this may have-
1259 no effect.-
1260-
1261 The available cursor shapes are:-
1262 \list-
1263 \li Qt.ArrowCursor-
1264 \li Qt.UpArrowCursor-
1265 \li Qt.CrossCursor-
1266 \li Qt.WaitCursor-
1267 \li Qt.IBeamCursor-
1268 \li Qt.SizeVerCursor-
1269 \li Qt.SizeHorCursor-
1270 \li Qt.SizeBDiagCursor-
1271 \li Qt.SizeFDiagCursor-
1272 \li Qt.SizeAllCursor-
1273 \li Qt.BlankCursor-
1274 \li Qt.SplitVCursor-
1275 \li Qt.SplitHCursor-
1276 \li Qt.PointingHandCursor-
1277 \li Qt.ForbiddenCursor-
1278 \li Qt.WhatsThisCursor-
1279 \li Qt.BusyCursor-
1280 \li Qt.OpenHandCursor-
1281 \li Qt.ClosedHandCursor-
1282 \li Qt.DragCopyCursor-
1283 \li Qt.DragMoveCursor-
1284 \li Qt.DragLinkCursor-
1285 \endlist-
1286-
1287 In order to only set a mouse cursor shape for a region without reacting-
1288 to mouse events set the acceptedButtons to none:-
1289-
1290 \code-
1291 MouseArea { cursorShape: Qt.IBeamCursor; acceptedButtons: Qt.NoButton }-
1292 \endcode-
1293-
1294 The default value is \c Qt.ArrowCursor.-
1295 \sa Qt::CursorShape-
1296*/-
1297-
1298#if QT_CONFIG(cursor)-
1299Qt::CursorShape QQuickMouseArea::cursorShape() const-
1300{-
1301 return cursor().shape();
executed 30 times by 2 tests: return cursor().shape();
Executed by:
  • tst_qqmlenginedebugservice
  • tst_qquickmousearea
30
1302}-
1303-
1304void QQuickMouseArea::setCursorShape(Qt::CursorShape shape)-
1305{-
1306 if (cursor().shape() == shape)
cursor().shape() == shapeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmousearea
2-4
1307 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickmousearea
2
1308-
1309 setCursor(shape);-
1310-
1311 emit cursorShapeChanged();-
1312}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
4
1313-
1314#endif-
1315-
1316-
1317/*!-
1318 \qmlproperty int QtQuick::MouseArea::pressAndHoldInterval-
1319 \since 5.9-
1320-
1321 This property overrides the elapsed time in milliseconds before-
1322 \c pressAndHold is emitted.-
1323-
1324 If not explicitly set -- or after reset -- the value follows-
1325 \c QStyleHints::mousePressAndHoldInterval.-
1326-
1327 Typically it's sufficient to set this property globally using the-
1328 application style hint. This property should be used when varying intervals-
1329 are needed for certain MouseAreas.-
1330-
1331 \sa pressAndHold-
1332*/-
1333int QQuickMouseArea::pressAndHoldInterval() const-
1334{-
1335 Q_D(const QQuickMouseArea);-
1336 return d->pressAndHoldInterval > -1 ?
executed 300 times by 7 tests: return d->pressAndHoldInterval > -1 ? d->pressAndHoldInterval : QGuiApplication::styleHints()->mousePressAndHoldInterval();
Executed by:
  • tst_qqmlenginedebugservice
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
300
1337 d->pressAndHoldInterval : QGuiApplication::styleHints()->mousePressAndHoldInterval();
executed 300 times by 7 tests: return d->pressAndHoldInterval > -1 ? d->pressAndHoldInterval : QGuiApplication::styleHints()->mousePressAndHoldInterval();
Executed by:
  • tst_qqmlenginedebugservice
  • tst_qquickflickable
  • tst_qquickitem
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
300
1338}-
1339-
1340void QQuickMouseArea::setPressAndHoldInterval(int interval)-
1341{-
1342 Q_D(QQuickMouseArea);-
1343 if (interval != d->pressAndHoldInterval) {
interval != d-...ndHoldIntervalDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickmousearea
FALSEnever evaluated
0-4
1344 d->pressAndHoldInterval = interval;-
1345 emit pressAndHoldIntervalChanged();-
1346 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
4
1347}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
4
1348-
1349void QQuickMouseArea::resetPressAndHoldInterval()-
1350{-
1351 Q_D(QQuickMouseArea);-
1352 if (d->pressAndHoldInterval > -1) {
d->pressAndHoldInterval > -1Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmousearea
0-2
1353 d->pressAndHoldInterval = -1;-
1354 emit pressAndHoldIntervalChanged();-
1355 }
never executed: end of block
0
1356}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmousearea
2
1357-
1358/*!-
1359 \qmlpropertygroup QtQuick::MouseArea::drag-
1360 \qmlproperty Item QtQuick::MouseArea::drag.target-
1361 \qmlproperty bool QtQuick::MouseArea::drag.active-
1362 \qmlproperty enumeration QtQuick::MouseArea::drag.axis-
1363 \qmlproperty real QtQuick::MouseArea::drag.minimumX-
1364 \qmlproperty real QtQuick::MouseArea::drag.maximumX-
1365 \qmlproperty real QtQuick::MouseArea::drag.minimumY-
1366 \qmlproperty real QtQuick::MouseArea::drag.maximumY-
1367 \qmlproperty bool QtQuick::MouseArea::drag.filterChildren-
1368 \qmlproperty real QtQuick::MouseArea::drag.threshold-
1369-
1370 \c drag provides a convenient way to make an item draggable.-
1371-
1372 \list-
1373 \li \c drag.target specifies the id of the item to drag.-
1374 \li \c drag.active specifies if the target item is currently being dragged.-
1375 \li \c drag.axis specifies whether dragging can be done horizontally (\c Drag.XAxis), vertically (\c Drag.YAxis), or both (\c Drag.XAndYAxis)-
1376 \li \c drag.minimum and \c drag.maximum limit how far the target can be dragged along the corresponding axes.-
1377 \endlist-
1378-
1379 The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity-
1380 of the rectangle is reduced when it is dragged to the right.-
1381-
1382 \snippet qml/mousearea/mousearea.qml drag-
1383-
1384 \note Items cannot be dragged if they are anchored for the requested-
1385 \c drag.axis. For example, if \c anchors.left or \c anchors.right was set-
1386 for \c rect in the above example, it cannot be dragged along the X-axis.-
1387 This can be avoided by settng the anchor value to \c undefined in-
1388 an \l {pressed}{onPressed} handler.-
1389-
1390 If \c drag.filterChildren is set to true, a drag can override descendant MouseAreas. This-
1391 enables a parent MouseArea to handle drags, for example, while descendants handle clicks:-
1392-
1393 \c drag.threshold determines the threshold in pixels of when the drag operation should-
1394 start. By default this is bound to a platform dependent value. This property was added in-
1395 Qt Quick 2.2.-
1396-
1397 If \c drag.smoothed is \c true, the target will be moved only after the drag operation has-
1398 started. If set to \c false, the target will be moved straight to the current mouse position.-
1399 By default, this property is \c true. This property was added in Qt Quick 2.4-
1400-
1401 See the \l Drag attached property and \l DropArea if you want to make a drop.-
1402-
1403 \snippet qml/mousearea/mouseareadragfilter.qml dragfilter-
1404-
1405*/-
1406-
1407#if QT_CONFIG(draganddrop)-
1408QQuickDrag *QQuickMouseArea::drag()-
1409{-
1410 Q_D(QQuickMouseArea);-
1411 if (!d->drag)
!d->dragDescription
TRUEevaluated 452 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
FALSEevaluated 3098 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
452-3098
1412 d->drag = new QQuickDrag;
executed 452 times by 6 tests: d->drag = new QQuickDrag;
Executed by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
452
1413 return d->drag;
executed 3550 times by 6 tests: return d->drag;
Executed by:
  • tst_examples
  • tst_qqmlenginedebugservice
  • tst_qquickflickable
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
3550
1414}-
1415#endif-
1416-
1417QSGNode *QQuickMouseArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)-
1418{-
1419 Q_UNUSED(data);-
1420 Q_D(QQuickMouseArea);-
1421-
1422 if (!qmlVisualTouchDebugging())
!qmlVisualTouchDebugging()Description
TRUEnever evaluated
FALSEnever evaluated
0
1423 return nullptr;
never executed: return nullptr;
0
1424-
1425 QSGInternalRectangleNode *rectangle = static_cast<QSGInternalRectangleNode *>(oldNode);-
1426 if (!rectangle) rectangle = d->sceneGraphContext()->createInternalRectangleNode();
never executed: rectangle = d->sceneGraphContext()->createInternalRectangleNode();
!rectangleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1427-
1428 rectangle->setRect(QRectF(0, 0, width(), height()));-
1429 rectangle->setColor(QColor(255, 0, 0, 50));-
1430 rectangle->update();-
1431 return rectangle;
never executed: return rectangle;
0
1432}-
1433-
1434QT_END_NAMESPACE-
1435-
1436#include "moc_qquickmousearea_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0