OpenCoverage

qquickpincharea_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickpincharea_p.h
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 QtSG module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQUICKPINCHAREA_H-
41#define QQUICKPINCHAREA_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include "qquickitem.h"-
55-
56QT_BEGIN_NAMESPACE-
57-
58class Q_AUTOTEST_EXPORT QQuickPinch : public QObject-
59{-
60 Q_OBJECT-
61-
62 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget RESET resetTarget)-
63 Q_PROPERTY(qreal minimumScale READ minimumScale WRITE setMinimumScale NOTIFY minimumScaleChanged)-
64 Q_PROPERTY(qreal maximumScale READ maximumScale WRITE setMaximumScale NOTIFY maximumScaleChanged)-
65 Q_PROPERTY(qreal minimumRotation READ minimumRotation WRITE setMinimumRotation NOTIFY minimumRotationChanged)-
66 Q_PROPERTY(qreal maximumRotation READ maximumRotation WRITE setMaximumRotation NOTIFY maximumRotationChanged)-
67 Q_PROPERTY(Axis dragAxis READ axis WRITE setAxis NOTIFY dragAxisChanged)-
68 Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin NOTIFY minimumXChanged)-
69 Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax NOTIFY maximumXChanged)-
70 Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin NOTIFY minimumYChanged)-
71 Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax NOTIFY maximumYChanged)-
72 Q_PROPERTY(bool active READ active NOTIFY activeChanged)-
73-
74public:-
75 QQuickPinch();-
76-
77 QQuickItem *target() const { return m_target; }
executed 190 times by 1 test: return m_target;
Executed by:
  • tst_qquickpincharea
190
78 void setTarget(QQuickItem *target) {-
79 if (target == m_target)
target == m_targetDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_qquickpincharea
  • tst_touchmouse
2-32
80 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
81 m_target = target;-
82 Q_EMIT targetChanged();-
83 }
executed 32 times by 2 tests: end of block
Executed by:
  • tst_qquickpincharea
  • tst_touchmouse
32
84 void resetTarget() {-
85 if (!m_target)
!m_targetDescription
TRUEnever evaluated
FALSEnever evaluated
0
86 return;
never executed: return;
0
87 m_target = nullptr;-
88 Q_EMIT targetChanged();-
89 }
never executed: end of block
0
90-
91 qreal minimumScale() const { return m_minScale; }
executed 26 times by 1 test: return m_minScale;
Executed by:
  • tst_qquickpincharea
26
92 void setMinimumScale(qreal s) {-
93 if (s == m_minScale)
s == m_minScaleDescription
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qquickpincharea
  • tst_touchmouse
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickpincharea
  • tst_touchmouse
4-18
94 return;
executed 18 times by 2 tests: return;
Executed by:
  • tst_qquickpincharea
  • tst_touchmouse
18
95 m_minScale = s;-
96 Q_EMIT minimumScaleChanged();-
97 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_qquickpincharea
  • tst_touchmouse
4
98 qreal maximumScale() const { return m_maxScale; }
executed 26 times by 1 test: return m_maxScale;
Executed by:
  • tst_qquickpincharea
26
99 void setMaximumScale(qreal s) {-
100 if (s == m_maxScale)
s == m_maxScaleDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickpincharea
  • tst_touchmouse
2-20
101 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
102 m_maxScale = s;-
103 Q_EMIT maximumScaleChanged();-
104 }
executed 20 times by 2 tests: end of block
Executed by:
  • tst_qquickpincharea
  • tst_touchmouse
20
105-
106 qreal minimumRotation() const { return m_minRotation; }
executed 48 times by 1 test: return m_minRotation;
Executed by:
  • tst_qquickpincharea
48
107 void setMinimumRotation(qreal r) {-
108 if (r == m_minRotation)
r == m_minRotationDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-12
109 return;
executed 12 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
12
110 m_minRotation = r;-
111 Q_EMIT minimumRotationChanged();-
112 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
2
113 qreal maximumRotation() const { return m_maxRotation; }
executed 48 times by 1 test: return m_maxRotation;
Executed by:
  • tst_qquickpincharea
48
114 void setMaximumRotation(qreal r) {-
115 if (r == m_maxRotation)
r == m_maxRotationDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-12
116 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
117 m_maxRotation = r;-
118 Q_EMIT maximumRotationChanged();-
119 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
12
120-
121 enum Axis { NoDrag=0x00, XAxis=0x01, YAxis=0x02, XAndYAxis=0x03, XandYAxis=XAndYAxis };-
122 Q_ENUM(Axis)-
123 Axis axis() const { return m_axis; }
executed 68 times by 1 test: return m_axis;
Executed by:
  • tst_qquickpincharea
68
124 void setAxis(Axis a) {-
125 if (a == m_axis)
a == m_axisDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-24
126 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
127 m_axis = a;-
128 Q_EMIT dragAxisChanged();-
129 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
24
130-
131 qreal xmin() const { return m_xmin; }
executed 26 times by 1 test: return m_xmin;
Executed by:
  • tst_qquickpincharea
26
132 void setXmin(qreal x) {-
133 if (x == m_xmin)
x == m_xminDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-12
134 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
135 m_xmin = x;-
136 Q_EMIT minimumXChanged();-
137 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
12
138 qreal xmax() const { return m_xmax; }
executed 28 times by 1 test: return m_xmax;
Executed by:
  • tst_qquickpincharea
28
139 void setXmax(qreal x) {-
140 if (x == m_xmax)
x == m_xmaxDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-12
141 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
142 m_xmax = x;-
143 Q_EMIT maximumXChanged();-
144 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
12
145 qreal ymin() const { return m_ymin; }
executed 26 times by 1 test: return m_ymin;
Executed by:
  • tst_qquickpincharea
26
146 void setYmin(qreal y) {-
147 if (y == m_ymin)
y == m_yminDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-12
148 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
149 m_ymin = y;-
150 Q_EMIT minimumYChanged();-
151 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
12
152 qreal ymax() const { return m_ymax; }
executed 26 times by 1 test: return m_ymax;
Executed by:
  • tst_qquickpincharea
26
153 void setYmax(qreal y) {-
154 if (y == m_ymax)
y == m_ymaxDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-12
155 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
156 m_ymax = y;-
157 Q_EMIT maximumYChanged();-
158 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
12
159-
160 bool active() const { return m_active; }
never executed: return m_active;
0
161 void setActive(bool a) {-
162 if (a == m_active)
a == m_activeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpincharea
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickpincharea
2-28
163 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpincharea
2
164 m_active = a;-
165 Q_EMIT activeChanged();-
166 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
28
167-
168Q_SIGNALS:-
169 void targetChanged();-
170 void minimumScaleChanged();-
171 void maximumScaleChanged();-
172 void minimumRotationChanged();-
173 void maximumRotationChanged();-
174 void dragAxisChanged();-
175 void minimumXChanged();-
176 void maximumXChanged();-
177 void minimumYChanged();-
178 void maximumYChanged();-
179 void activeChanged();-
180-
181private:-
182 QQuickItem *m_target;-
183 qreal m_minScale;-
184 qreal m_maxScale;-
185 qreal m_minRotation;-
186 qreal m_maxRotation;-
187 Axis m_axis;-
188 qreal m_xmin;-
189 qreal m_xmax;-
190 qreal m_ymin;-
191 qreal m_ymax;-
192 bool m_active;-
193};-
194-
195class Q_AUTOTEST_EXPORT QQuickPinchEvent : public QObject-
196{-
197 Q_OBJECT-
198-
199 Q_PROPERTY(QPointF center READ center)-
200 Q_PROPERTY(QPointF startCenter READ startCenter)-
201 Q_PROPERTY(QPointF previousCenter READ previousCenter)-
202 Q_PROPERTY(qreal scale READ scale)-
203 Q_PROPERTY(qreal previousScale READ previousScale)-
204 Q_PROPERTY(qreal angle READ angle)-
205 Q_PROPERTY(qreal previousAngle READ previousAngle)-
206 Q_PROPERTY(qreal rotation READ rotation)-
207 Q_PROPERTY(QPointF point1 READ point1)-
208 Q_PROPERTY(QPointF startPoint1 READ startPoint1)-
209 Q_PROPERTY(QPointF point2 READ point2)-
210 Q_PROPERTY(QPointF startPoint2 READ startPoint2)-
211 Q_PROPERTY(int pointCount READ pointCount)-
212 Q_PROPERTY(bool accepted READ accepted WRITE setAccepted)-
213-
214public:-
215 QQuickPinchEvent(QPointF c, qreal s, qreal a, qreal r)-
216 : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r)-
217 , m_pointCount(0), m_accepted(true) {}
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
218-
219 QPointF center() const { return m_center; }
executed 38 times by 1 test: return m_center;
Executed by:
  • tst_qquickpincharea
38
220 QPointF startCenter() const { return m_startCenter; }
never executed: return m_startCenter;
0
221 void setStartCenter(QPointF c) { m_startCenter = c; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
222 QPointF previousCenter() const { return m_lastCenter; }
never executed: return m_lastCenter;
0
223 void setPreviousCenter(QPointF c) { m_lastCenter = c; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
224 qreal scale() const { return m_scale; }
executed 38 times by 1 test: return m_scale;
Executed by:
  • tst_qquickpincharea
38
225 qreal previousScale() const { return m_lastScale; }
never executed: return m_lastScale;
0
226 void setPreviousScale(qreal s) { m_lastScale = s; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
227 qreal angle() const { return m_angle; }
never executed: return m_angle;
0
228 qreal previousAngle() const { return m_lastAngle; }
never executed: return m_lastAngle;
0
229 void setPreviousAngle(qreal a) { m_lastAngle = a; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
230 qreal rotation() const { return m_rotation; }
never executed: return m_rotation;
0
231 QPointF point1() const { return m_point1; }
never executed: return m_point1;
0
232 void setPoint1(QPointF p) { m_point1 = p; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
233 QPointF startPoint1() const { return m_startPoint1; }
executed 4 times by 1 test: return m_startPoint1;
Executed by:
  • tst_qquickpincharea
4
234 void setStartPoint1(QPointF p) { m_startPoint1 = p; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
235 QPointF point2() const { return m_point2; }
never executed: return m_point2;
0
236 void setPoint2(QPointF p) { m_point2 = p; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
237 QPointF startPoint2() const { return m_startPoint2; }
executed 4 times by 1 test: return m_startPoint2;
Executed by:
  • tst_qquickpincharea
4
238 void setStartPoint2(QPointF p) { m_startPoint2 = p; }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
50
239 int pointCount() const { return m_pointCount; }
executed 38 times by 1 test: return m_pointCount;
Executed by:
  • tst_qquickpincharea
38
240 void setPointCount(int count) { m_pointCount = count; }
executed 36 times by 1 test: end of block
Executed by:
  • tst_qquickpincharea
36
241-
242 bool accepted() const { return m_accepted; }
executed 16 times by 1 test: return m_accepted;
Executed by:
  • tst_qquickpincharea
16
243 void setAccepted(bool a) { m_accepted = a; }
never executed: end of block
0
244-
245private:-
246 QPointF m_center;-
247 QPointF m_startCenter;-
248 QPointF m_lastCenter;-
249 qreal m_scale;-
250 qreal m_lastScale;-
251 qreal m_angle;-
252 qreal m_lastAngle;-
253 qreal m_rotation;-
254 QPointF m_point1;-
255 QPointF m_point2;-
256 QPointF m_startPoint1;-
257 QPointF m_startPoint2;-
258 int m_pointCount;-
259 bool m_accepted;-
260};-
261-
262-
263class QQuickMouseEvent;-
264class QQuickPinchAreaPrivate;-
265class Q_AUTOTEST_EXPORT QQuickPinchArea : public QQuickItem-
266{-
267 Q_OBJECT-
268-
269 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)-
270 Q_PROPERTY(QQuickPinch *pinch READ pinch CONSTANT)-
271-
272public:-
273 QQuickPinchArea(QQuickItem *parent=nullptr);-
274 ~QQuickPinchArea();-
275-
276 bool isEnabled() const;-
277 void setEnabled(bool);-
278-
279 QQuickPinch *pinch();-
280-
281Q_SIGNALS:-
282 void enabledChanged();-
283 void pinchStarted(QQuickPinchEvent *pinch);-
284 void pinchUpdated(QQuickPinchEvent *pinch);-
285 void pinchFinished(QQuickPinchEvent *pinch);-
286 Q_REVISION(1) void smartZoom(QQuickPinchEvent *pinch);-
287-
288protected:-
289 bool childMouseEventFilter(QQuickItem *i, QEvent *e) override;-
290 void touchEvent(QTouchEvent *event) override;-
291-
292 void geometryChanged(const QRectF &newGeometry,-
293 const QRectF &oldGeometry) override;-
294 void itemChange(ItemChange change, const ItemChangeData& value) override;-
295 bool event(QEvent *) override;-
296-
297private:-
298 void clearPinch();-
299 void cancelPinch();-
300 void updatePinch();-
301 void updatePinchTarget();-
302 void handlePress();-
303 void handleRelease();-
304-
305private:-
306 Q_DISABLE_COPY(QQuickPinchArea)-
307 Q_DECLARE_PRIVATE(QQuickPinchArea)
executed 748 times by 3 tests: return reinterpret_cast<QQuickPinchAreaPrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickpincharea
  • tst_touchmouse
never executed: return reinterpret_cast<const QQuickPinchAreaPrivate *>(qGetPtrHelper(d_ptr));
0-748
308};-
309-
310QT_END_NAMESPACE-
311-
312QML_DECLARE_TYPE(QQuickPinch)-
313QML_DECLARE_TYPE(QQuickPinchEvent)-
314QML_DECLARE_TYPE(QQuickPinchArea)-
315-
316#endif // QQUICKPINCHAREA_H-
317-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0