author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 14 May 2010 16:40:13 +0300 | |
changeset 22 | 79de32ba3296 |
parent 18 | 2f34d5167611 |
child 30 | 5dc02b23752f |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "qgesture.h" |
|
43 |
#include "private/qgesture_p.h" |
|
44 |
||
45 |
QT_BEGIN_NAMESPACE |
|
46 |
||
47 |
/*! |
|
48 |
\class QGesture |
|
49 |
\since 4.6 |
|
50 |
\ingroup gestures |
|
51 |
||
52 |
\brief The QGesture class represents a gesture, containing properties that |
|
53 |
describe the corresponding user input. |
|
54 |
||
55 |
Gesture objects are not constructed directly by developers. They are created by |
|
56 |
the QGestureRecognizer object that is registered with the application; see |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
QGestureRecognizer::registerRecognizer(). |
0 | 58 |
|
59 |
\section1 Gesture Properties |
|
60 |
||
61 |
The class has a list of properties that can be queried by the user to get |
|
62 |
some gesture-specific arguments. For example, the pinch gesture has a scale |
|
63 |
factor that is exposed as a property. |
|
64 |
||
65 |
Developers of custom gesture recognizers can add additional properties in |
|
66 |
order to provide additional information about a gesture. This can be done |
|
67 |
by adding new dynamic properties to a QGesture object, or by subclassing |
|
68 |
the QGesture class (or one of its subclasses). |
|
69 |
||
70 |
\section1 Lifecycle of a Gesture Object |
|
71 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
A QGesture instance is implicitly created when needed and is owned by Qt. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
Developers should never destroy them or store them for later use as Qt may |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
destroy particular instances of them and create new ones to replace them. |
0 | 75 |
|
76 |
The registered gesture recognizer monitors the input events for the target |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
object via its \l{QGestureRecognizer::}{recognize()} function, updating the |
0 | 78 |
properties of the gesture object as required. |
79 |
||
80 |
The gesture object may be delivered to the target object in a QGestureEvent if |
|
81 |
the corresponding gesture is active or has just been canceled. Each event that |
|
82 |
is delivered contains a list of gesture objects, since support for more than |
|
83 |
one gesture may be enabled for the target object. Due to the way events are |
|
84 |
handled in Qt, gesture events may be filtered by other objects. |
|
85 |
||
86 |
\sa QGestureEvent, QGestureRecognizer |
|
87 |
*/ |
|
88 |
||
89 |
/*! |
|
90 |
Constructs a new gesture object with the given \a parent. |
|
91 |
||
92 |
QGesture objects are created by gesture recognizers in the |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
QGestureRecognizer::create() function. |
0 | 94 |
*/ |
95 |
QGesture::QGesture(QObject *parent) |
|
96 |
: QObject(*new QGesturePrivate, parent) |
|
97 |
{ |
|
98 |
d_func()->gestureType = Qt::CustomGesture; |
|
99 |
} |
|
100 |
||
101 |
/*! |
|
102 |
\internal |
|
103 |
*/ |
|
104 |
QGesture::QGesture(QGesturePrivate &dd, QObject *parent) |
|
105 |
: QObject(dd, parent) |
|
106 |
{ |
|
107 |
} |
|
108 |
||
109 |
/*! |
|
110 |
Destroys the gesture object. |
|
111 |
*/ |
|
112 |
QGesture::~QGesture() |
|
113 |
{ |
|
114 |
} |
|
115 |
||
116 |
/*! |
|
117 |
\property QGesture::state |
|
118 |
\brief the current state of the gesture |
|
119 |
*/ |
|
120 |
||
121 |
/*! |
|
122 |
\property QGesture::gestureType |
|
123 |
\brief the type of the gesture |
|
124 |
*/ |
|
125 |
||
126 |
/*! |
|
127 |
\property QGesture::hotSpot |
|
128 |
||
129 |
\brief The point that is used to find the receiver for the gesture event. |
|
130 |
||
131 |
The hot-spot is a point in the global coordinate system, use |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a |
0 | 133 |
local hot-spot. |
134 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
135 |
The hot-spot should be set by the gesture recognizer to allow gesture event |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
136 |
delivery to a QGraphicsObject. |
0 | 137 |
*/ |
138 |
||
139 |
/*! |
|
140 |
\property QGesture::hasHotSpot |
|
141 |
\brief whether the gesture has a hot-spot |
|
142 |
*/ |
|
143 |
||
144 |
Qt::GestureType QGesture::gestureType() const |
|
145 |
{ |
|
146 |
return d_func()->gestureType; |
|
147 |
} |
|
148 |
||
149 |
Qt::GestureState QGesture::state() const |
|
150 |
{ |
|
151 |
return d_func()->state; |
|
152 |
} |
|
153 |
||
154 |
QPointF QGesture::hotSpot() const |
|
155 |
{ |
|
156 |
return d_func()->hotSpot; |
|
157 |
} |
|
158 |
||
159 |
void QGesture::setHotSpot(const QPointF &value) |
|
160 |
{ |
|
161 |
Q_D(QGesture); |
|
162 |
d->hotSpot = value; |
|
163 |
d->isHotSpotSet = true; |
|
164 |
} |
|
165 |
||
166 |
bool QGesture::hasHotSpot() const |
|
167 |
{ |
|
168 |
return d_func()->isHotSpotSet; |
|
169 |
} |
|
170 |
||
171 |
void QGesture::unsetHotSpot() |
|
172 |
{ |
|
173 |
d_func()->isHotSpotSet = false; |
|
174 |
} |
|
175 |
||
176 |
/*! |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
177 |
\property QGesture::gestureCancelPolicy |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
\brief the policy for deciding what happens on accepting a gesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
On accepting one gesture Qt can automatically cancel other gestures |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
that belong to other targets. The policy is normally set to not cancel |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
any other gestures and can be set to cancel all active gestures in the |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
183 |
context. For example for all child widgets. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
186 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
\enum QGesture::GestureCancelPolicy |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
189 |
This enum describes how accepting a gesture can cancel other gestures |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
190 |
automatically. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
191 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
192 |
\value CancelNone On accepting this gesture no other gestures will be affected. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
193 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
\value CancelAllInContext On accepting this gesture all gestures that are |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
195 |
active in the context (respecting the Qt::GestureFlag that were specified |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
196 |
when subscribed to the gesture) will be cancelled. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
197 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
198 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
199 |
void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
200 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
201 |
Q_D(QGesture); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
d->gestureCancelPolicy = static_cast<uint>(policy); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
203 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
204 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
205 |
QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
206 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
207 |
Q_D(const QGesture); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
208 |
return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
210 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
211 |
/*! |
0 | 212 |
\class QPanGesture |
213 |
\since 4.6 |
|
214 |
\brief The QPanGesture class describes a panning gesture made by the user. |
|
215 |
\ingroup gestures |
|
216 |
||
217 |
\image pangesture.png |
|
218 |
||
219 |
\sa {Gestures Programming}, QPinchGesture, QSwipeGesture |
|
220 |
*/ |
|
221 |
||
222 |
/*! |
|
223 |
\property QPanGesture::lastOffset |
|
224 |
\brief the last offset recorded for this gesture |
|
225 |
||
226 |
The last offset contains the change in position of the user's input as |
|
227 |
reported in the \l offset property when a previous gesture event was |
|
228 |
delivered for this gesture. |
|
229 |
||
230 |
If no previous event was delivered with information about this gesture |
|
231 |
(i.e., this gesture object contains information about the first movement |
|
232 |
in the gesture) then this property contains a zero size. |
|
233 |
*/ |
|
234 |
||
235 |
/*! |
|
236 |
\property QPanGesture::offset |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
237 |
\brief the total offset from the first input position to the current input |
0 | 238 |
position |
239 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
240 |
The offset measures the total change in position of the user's input |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
241 |
covered by the gesture on the input device. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
242 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
243 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
244 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
245 |
\property QPanGesture::delta |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
246 |
\brief the offset from the previous input position to the current input |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
248 |
This is essentially the same as the difference between offset() and |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
249 |
lastOffset(). |
0 | 250 |
*/ |
251 |
||
252 |
/*! |
|
253 |
\property QPanGesture::acceleration |
|
254 |
*/ |
|
255 |
||
256 |
/*! |
|
257 |
\internal |
|
258 |
*/ |
|
259 |
QPanGesture::QPanGesture(QObject *parent) |
|
260 |
: QGesture(*new QPanGesturePrivate, parent) |
|
261 |
{ |
|
262 |
d_func()->gestureType = Qt::PanGesture; |
|
263 |
} |
|
264 |
||
265 |
||
266 |
QPointF QPanGesture::lastOffset() const |
|
267 |
{ |
|
268 |
return d_func()->lastOffset; |
|
269 |
} |
|
270 |
||
271 |
QPointF QPanGesture::offset() const |
|
272 |
{ |
|
273 |
return d_func()->offset; |
|
274 |
} |
|
275 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
276 |
QPointF QPanGesture::delta() const |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
277 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
278 |
Q_D(const QPanGesture); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
279 |
return d->offset - d->lastOffset; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
280 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
281 |
|
0 | 282 |
qreal QPanGesture::acceleration() const |
283 |
{ |
|
284 |
return d_func()->acceleration; |
|
285 |
} |
|
286 |
||
287 |
void QPanGesture::setLastOffset(const QPointF &value) |
|
288 |
{ |
|
289 |
d_func()->lastOffset = value; |
|
290 |
} |
|
291 |
||
292 |
void QPanGesture::setOffset(const QPointF &value) |
|
293 |
{ |
|
294 |
d_func()->offset = value; |
|
295 |
} |
|
296 |
||
297 |
void QPanGesture::setAcceleration(qreal value) |
|
298 |
{ |
|
299 |
d_func()->acceleration = value; |
|
300 |
} |
|
301 |
||
302 |
/*! |
|
303 |
\class QPinchGesture |
|
304 |
\since 4.6 |
|
305 |
\brief The QPinchGesture class describes a pinch gesture made my the user. |
|
306 |
\ingroup multitouch |
|
307 |
\ingroup gestures |
|
308 |
||
309 |
A pinch gesture is a form of multitouch user input in which the user typically |
|
310 |
touches two points on the input device with a thumb and finger, before moving |
|
311 |
them closer together or further apart to change the scale factor, zoom, or level |
|
312 |
of detail of the user interface. |
|
313 |
||
314 |
\image pinchgesture.png |
|
315 |
||
316 |
Instead of repeatedly applying the same pinching gesture, the user may |
|
317 |
continue to touch the input device in one place, and apply a second touch |
|
318 |
to a new point, continuing the gesture. When this occurs, gesture events |
|
319 |
will continue to be delivered to the target object, containing an instance |
|
320 |
of QPinchGesture in the Qt::GestureUpdated state. |
|
321 |
||
322 |
\sa {Gestures Programming}, QPanGesture, QSwipeGesture |
|
323 |
*/ |
|
324 |
||
325 |
/*! |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
326 |
\enum QPinchGesture::ChangeFlag |
0 | 327 |
|
328 |
This enum describes the changes that can occur to the properties of |
|
329 |
the gesture object. |
|
330 |
||
331 |
\value ScaleFactorChanged The scale factor held by scaleFactor changed. |
|
332 |
\value RotationAngleChanged The rotation angle held by rotationAngle changed. |
|
333 |
\value CenterPointChanged The center point held by centerPoint changed. |
|
334 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
335 |
\sa changeFlags, totalChangeFlags |
0 | 336 |
*/ |
337 |
||
338 |
/*! |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
339 |
\property QPinchGesture::totalChangeFlags |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
340 |
\brief the property of the gesture that has change |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
341 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
342 |
This property indicates which of the other properties has changed since the |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
343 |
gesture has started. You can use this information to determine which aspect |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
344 |
of your user interface needs to be updated. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
345 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
346 |
\sa changeFlags, scaleFactor, rotationAngle, centerPoint |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
347 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
348 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
349 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
350 |
\property QPinchGesture::changeFlags |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
351 |
\brief the property of the gesture that has changed in the current step |
0 | 352 |
|
353 |
This property indicates which of the other properties has changed since |
|
354 |
the previous gesture event included information about this gesture. You |
|
355 |
can use this information to determine which aspect of your user interface |
|
356 |
needs to be updated. |
|
357 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
\sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint |
0 | 359 |
*/ |
360 |
||
361 |
/*! |
|
362 |
\property QPinchGesture::totalScaleFactor |
|
363 |
\brief the total scale factor |
|
364 |
||
365 |
The total scale factor measures the total change in scale factor from the |
|
366 |
original value to the current scale factor. |
|
367 |
||
368 |
\sa scaleFactor, lastScaleFactor |
|
369 |
*/ |
|
370 |
/*! |
|
371 |
\property QPinchGesture::lastScaleFactor |
|
372 |
\brief the last scale factor recorded for this gesture |
|
373 |
||
374 |
The last scale factor contains the scale factor reported in the |
|
375 |
\l scaleFactor property when a previous gesture event included |
|
376 |
information about this gesture. |
|
377 |
||
378 |
If no previous event was delivered with information about this gesture |
|
379 |
(i.e., this gesture object contains information about the first movement |
|
380 |
in the gesture) then this property contains zero. |
|
381 |
||
382 |
\sa scaleFactor, totalScaleFactor |
|
383 |
*/ |
|
384 |
/*! |
|
385 |
\property QPinchGesture::scaleFactor |
|
386 |
\brief the current scale factor |
|
387 |
||
388 |
The scale factor measures the scale factor associated with the distance |
|
389 |
between two of the user's inputs on a multitouch device. |
|
390 |
||
391 |
\sa totalScaleFactor, lastScaleFactor |
|
392 |
*/ |
|
393 |
||
394 |
/*! |
|
395 |
\property QPinchGesture::totalRotationAngle |
|
396 |
\brief the total angle covered by the gesture |
|
397 |
||
398 |
This total angle measures the complete angle covered by the gesture. Usually, this |
|
399 |
is equal to the value held by the \l rotationAngle property, except in the case where |
|
400 |
the user performs multiple rotations by removing and repositioning one of the touch |
|
401 |
points, as described above. In this case, the total angle will be the sum of the |
|
402 |
rotation angles for the multiple stages of the gesture. |
|
403 |
||
404 |
\sa rotationAngle, lastRotationAngle |
|
405 |
*/ |
|
406 |
/*! |
|
407 |
\property QPinchGesture::lastRotationAngle |
|
408 |
\brief the last reported angle covered by the gesture motion |
|
409 |
||
410 |
The last rotation angle is the angle as reported in the \l rotationAngle property |
|
411 |
when a previous gesture event was delivered for this gesture. |
|
412 |
||
413 |
\sa rotationAngle, totalRotationAngle |
|
414 |
*/ |
|
415 |
/*! |
|
416 |
\property QPinchGesture::rotationAngle |
|
417 |
\brief the angle covered by the gesture motion |
|
418 |
||
419 |
\sa totalRotationAngle, lastRotationAngle |
|
420 |
*/ |
|
421 |
||
422 |
/*! |
|
423 |
\property QPinchGesture::startCenterPoint |
|
424 |
\brief the starting position of the center point |
|
425 |
||
426 |
\sa centerPoint, lastCenterPoint |
|
427 |
*/ |
|
428 |
/*! |
|
429 |
\property QPinchGesture::lastCenterPoint |
|
430 |
\brief the last position of the center point recorded for this gesture |
|
431 |
||
432 |
\sa centerPoint, startCenterPoint |
|
433 |
*/ |
|
434 |
/*! |
|
435 |
\property QPinchGesture::centerPoint |
|
436 |
\brief the current center point |
|
437 |
||
438 |
The center point is the midpoint between the two input points in the gesture. |
|
439 |
||
440 |
\sa startCenterPoint, lastCenterPoint |
|
441 |
*/ |
|
442 |
||
443 |
/*! |
|
444 |
\internal |
|
445 |
*/ |
|
446 |
QPinchGesture::QPinchGesture(QObject *parent) |
|
447 |
: QGesture(*new QPinchGesturePrivate, parent) |
|
448 |
{ |
|
449 |
d_func()->gestureType = Qt::PinchGesture; |
|
450 |
} |
|
451 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
452 |
QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const |
0 | 453 |
{ |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
454 |
return d_func()->totalChangeFlags; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
455 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
456 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
457 |
void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
458 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
459 |
d_func()->totalChangeFlags = value; |
0 | 460 |
} |
461 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
462 |
QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const |
0 | 463 |
{ |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
464 |
return d_func()->changeFlags; |
0 | 465 |
} |
466 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
468 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
469 |
d_func()->changeFlags = value; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
} |
0 | 471 |
|
472 |
QPointF QPinchGesture::startCenterPoint() const |
|
473 |
{ |
|
474 |
return d_func()->startCenterPoint; |
|
475 |
} |
|
476 |
||
477 |
QPointF QPinchGesture::lastCenterPoint() const |
|
478 |
{ |
|
479 |
return d_func()->lastCenterPoint; |
|
480 |
} |
|
481 |
||
482 |
QPointF QPinchGesture::centerPoint() const |
|
483 |
{ |
|
484 |
return d_func()->centerPoint; |
|
485 |
} |
|
486 |
||
487 |
void QPinchGesture::setStartCenterPoint(const QPointF &value) |
|
488 |
{ |
|
489 |
d_func()->startCenterPoint = value; |
|
490 |
} |
|
491 |
||
492 |
void QPinchGesture::setLastCenterPoint(const QPointF &value) |
|
493 |
{ |
|
494 |
d_func()->lastCenterPoint = value; |
|
495 |
} |
|
496 |
||
497 |
void QPinchGesture::setCenterPoint(const QPointF &value) |
|
498 |
{ |
|
499 |
d_func()->centerPoint = value; |
|
500 |
} |
|
501 |
||
502 |
||
503 |
qreal QPinchGesture::totalScaleFactor() const |
|
504 |
{ |
|
505 |
return d_func()->totalScaleFactor; |
|
506 |
} |
|
507 |
||
508 |
qreal QPinchGesture::lastScaleFactor() const |
|
509 |
{ |
|
510 |
return d_func()->lastScaleFactor; |
|
511 |
} |
|
512 |
||
513 |
qreal QPinchGesture::scaleFactor() const |
|
514 |
{ |
|
515 |
return d_func()->scaleFactor; |
|
516 |
} |
|
517 |
||
518 |
void QPinchGesture::setTotalScaleFactor(qreal value) |
|
519 |
{ |
|
520 |
d_func()->totalScaleFactor = value; |
|
521 |
} |
|
522 |
||
523 |
void QPinchGesture::setLastScaleFactor(qreal value) |
|
524 |
{ |
|
525 |
d_func()->lastScaleFactor = value; |
|
526 |
} |
|
527 |
||
528 |
void QPinchGesture::setScaleFactor(qreal value) |
|
529 |
{ |
|
530 |
d_func()->scaleFactor = value; |
|
531 |
} |
|
532 |
||
533 |
||
534 |
qreal QPinchGesture::totalRotationAngle() const |
|
535 |
{ |
|
536 |
return d_func()->totalRotationAngle; |
|
537 |
} |
|
538 |
||
539 |
qreal QPinchGesture::lastRotationAngle() const |
|
540 |
{ |
|
541 |
return d_func()->lastRotationAngle; |
|
542 |
} |
|
543 |
||
544 |
qreal QPinchGesture::rotationAngle() const |
|
545 |
{ |
|
546 |
return d_func()->rotationAngle; |
|
547 |
} |
|
548 |
||
549 |
void QPinchGesture::setTotalRotationAngle(qreal value) |
|
550 |
{ |
|
551 |
d_func()->totalRotationAngle = value; |
|
552 |
} |
|
553 |
||
554 |
void QPinchGesture::setLastRotationAngle(qreal value) |
|
555 |
{ |
|
556 |
d_func()->lastRotationAngle = value; |
|
557 |
} |
|
558 |
||
559 |
void QPinchGesture::setRotationAngle(qreal value) |
|
560 |
{ |
|
561 |
d_func()->rotationAngle = value; |
|
562 |
} |
|
563 |
||
564 |
/*! |
|
565 |
\class QSwipeGesture |
|
566 |
\since 4.6 |
|
567 |
\brief The QSwipeGesture class describes a swipe gesture made by the user. |
|
568 |
\ingroup gestures |
|
569 |
||
570 |
\image swipegesture.png |
|
571 |
||
572 |
\sa {Gestures Programming}, QPanGesture, QPinchGesture |
|
573 |
*/ |
|
574 |
||
575 |
/*! |
|
576 |
\enum QSwipeGesture::SwipeDirection |
|
577 |
||
578 |
This enum describes the possible directions for the gesture's motion |
|
579 |
along the horizontal and vertical axes. |
|
580 |
||
581 |
\value NoDirection The gesture had no motion associated with it on a particular axis. |
|
582 |
\value Left The gesture involved a horizontal motion to the left. |
|
583 |
\value Right The gesture involved a horizontal motion to the right. |
|
584 |
\value Up The gesture involved an upward vertical motion. |
|
585 |
\value Down The gesture involved a downward vertical motion. |
|
586 |
*/ |
|
587 |
||
588 |
/*! |
|
589 |
\property QSwipeGesture::horizontalDirection |
|
590 |
\brief the horizontal direction of the gesture |
|
591 |
||
592 |
If the gesture has a horizontal component, the horizontal direction |
|
593 |
is either Left or Right; otherwise, it is NoDirection. |
|
594 |
||
595 |
\sa verticalDirection, swipeAngle |
|
596 |
*/ |
|
597 |
||
598 |
/*! |
|
599 |
\property QSwipeGesture::verticalDirection |
|
600 |
\brief the vertical direction of the gesture |
|
601 |
||
602 |
If the gesture has a vertical component, the vertical direction |
|
603 |
is either Up or Down; otherwise, it is NoDirection. |
|
604 |
||
605 |
\sa horizontalDirection, swipeAngle |
|
606 |
*/ |
|
607 |
||
608 |
/*! |
|
609 |
\property QSwipeGesture::swipeAngle |
|
610 |
\brief the angle of the motion associated with the gesture |
|
611 |
||
612 |
If the gesture has either a horizontal or vertical component, the |
|
613 |
swipe angle describes the angle between the direction of motion and the |
|
614 |
x-axis as defined using the standard widget |
|
615 |
\l{The Coordinate System}{coordinate system}. |
|
616 |
||
617 |
\sa horizontalDirection, verticalDirection |
|
618 |
*/ |
|
619 |
||
620 |
/*! |
|
621 |
\internal |
|
622 |
*/ |
|
623 |
QSwipeGesture::QSwipeGesture(QObject *parent) |
|
624 |
: QGesture(*new QSwipeGesturePrivate, parent) |
|
625 |
{ |
|
626 |
d_func()->gestureType = Qt::SwipeGesture; |
|
627 |
} |
|
628 |
||
629 |
QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const |
|
630 |
{ |
|
631 |
Q_D(const QSwipeGesture); |
|
632 |
if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270) |
|
633 |
return QSwipeGesture::NoDirection; |
|
634 |
else if (d->swipeAngle < 90 || d->swipeAngle > 270) |
|
635 |
return QSwipeGesture::Right; |
|
636 |
else |
|
637 |
return QSwipeGesture::Left; |
|
638 |
} |
|
639 |
||
640 |
QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const |
|
641 |
{ |
|
642 |
Q_D(const QSwipeGesture); |
|
643 |
if (d->swipeAngle <= 0 || d->swipeAngle == 180) |
|
644 |
return QSwipeGesture::NoDirection; |
|
645 |
else if (d->swipeAngle < 180) |
|
646 |
return QSwipeGesture::Up; |
|
647 |
else |
|
648 |
return QSwipeGesture::Down; |
|
649 |
} |
|
650 |
||
651 |
qreal QSwipeGesture::swipeAngle() const |
|
652 |
{ |
|
653 |
return d_func()->swipeAngle; |
|
654 |
} |
|
655 |
||
656 |
void QSwipeGesture::setSwipeAngle(qreal value) |
|
657 |
{ |
|
658 |
d_func()->swipeAngle = value; |
|
659 |
} |
|
660 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
661 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
662 |
\class QTapGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
663 |
\since 4.6 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
664 |
\brief The QTapGesture class describes a tap gesture made by the user. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
665 |
\ingroup gestures |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
666 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
667 |
\sa {Gestures Programming}, QPanGesture, QPinchGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
668 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
669 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
670 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
671 |
\property QTapGesture::position |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
672 |
\brief the position of the tap |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
673 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
674 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
675 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
676 |
\internal |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
677 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
678 |
QTapGesture::QTapGesture(QObject *parent) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
679 |
: QGesture(*new QTapGesturePrivate, parent) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
680 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
681 |
d_func()->gestureType = Qt::TapGesture; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
QPointF QTapGesture::position() const |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
685 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
686 |
return d_func()->position; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
687 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
688 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
689 |
void QTapGesture::setPosition(const QPointF &value) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
690 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
691 |
d_func()->position = value; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
692 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
693 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
694 |
\class QTapAndHoldGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
695 |
\since 4.6 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
696 |
\brief The QTapAndHoldGesture class describes a tap-and-hold (aka LongTap) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
697 |
gesture made by the user. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
698 |
\ingroup gestures |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
699 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
700 |
\sa {Gestures Programming}, QPanGesture, QPinchGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
701 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
702 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
703 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
704 |
\property QTapAndHoldGesture::position |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
705 |
\brief the position of the tap |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
706 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
707 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
708 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
709 |
\internal |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
710 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
711 |
QTapAndHoldGesture::QTapAndHoldGesture(QObject *parent) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
712 |
: QGesture(*new QTapAndHoldGesturePrivate, parent) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
713 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
714 |
d_func()->gestureType = Qt::TapAndHoldGesture; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
715 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
716 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
717 |
QPointF QTapAndHoldGesture::position() const |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
718 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
719 |
return d_func()->position; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
720 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
721 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
722 |
void QTapAndHoldGesture::setPosition(const QPointF &value) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
723 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
724 |
d_func()->position = value; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
725 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
726 |
|
0 | 727 |
QT_END_NAMESPACE |