author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 02 Sep 2010 21:20:32 +0300 | |
changeset 34 | a33bf25e6f72 |
parent 33 | 3e2da88830cd |
child 37 | 758a864f9613 |
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" |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
44 |
#include "private/qstandardgestures_p.h" |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
45 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
46 |
#ifndef QT_NO_GESTURES |
0 | 47 |
|
48 |
QT_BEGIN_NAMESPACE |
|
49 |
||
50 |
/*! |
|
51 |
\class QGesture |
|
52 |
\since 4.6 |
|
53 |
\ingroup gestures |
|
54 |
||
55 |
\brief The QGesture class represents a gesture, containing properties that |
|
56 |
describe the corresponding user input. |
|
57 |
||
58 |
Gesture objects are not constructed directly by developers. They are created by |
|
59 |
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
|
60 |
QGestureRecognizer::registerRecognizer(). |
0 | 61 |
|
62 |
\section1 Gesture Properties |
|
63 |
||
64 |
The class has a list of properties that can be queried by the user to get |
|
65 |
some gesture-specific arguments. For example, the pinch gesture has a scale |
|
66 |
factor that is exposed as a property. |
|
67 |
||
68 |
Developers of custom gesture recognizers can add additional properties in |
|
69 |
order to provide additional information about a gesture. This can be done |
|
70 |
by adding new dynamic properties to a QGesture object, or by subclassing |
|
71 |
the QGesture class (or one of its subclasses). |
|
72 |
||
73 |
\section1 Lifecycle of a Gesture Object |
|
74 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
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
|
76 |
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
|
77 |
destroy particular instances of them and create new ones to replace them. |
0 | 78 |
|
79 |
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
|
80 |
object via its \l{QGestureRecognizer::}{recognize()} function, updating the |
0 | 81 |
properties of the gesture object as required. |
82 |
||
83 |
The gesture object may be delivered to the target object in a QGestureEvent if |
|
84 |
the corresponding gesture is active or has just been canceled. Each event that |
|
85 |
is delivered contains a list of gesture objects, since support for more than |
|
86 |
one gesture may be enabled for the target object. Due to the way events are |
|
87 |
handled in Qt, gesture events may be filtered by other objects. |
|
88 |
||
89 |
\sa QGestureEvent, QGestureRecognizer |
|
90 |
*/ |
|
91 |
||
92 |
/*! |
|
93 |
Constructs a new gesture object with the given \a parent. |
|
94 |
||
95 |
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
|
96 |
QGestureRecognizer::create() function. |
0 | 97 |
*/ |
98 |
QGesture::QGesture(QObject *parent) |
|
99 |
: QObject(*new QGesturePrivate, parent) |
|
100 |
{ |
|
101 |
d_func()->gestureType = Qt::CustomGesture; |
|
102 |
} |
|
103 |
||
104 |
/*! |
|
105 |
\internal |
|
106 |
*/ |
|
107 |
QGesture::QGesture(QGesturePrivate &dd, QObject *parent) |
|
108 |
: QObject(dd, parent) |
|
109 |
{ |
|
110 |
} |
|
111 |
||
112 |
/*! |
|
113 |
Destroys the gesture object. |
|
114 |
*/ |
|
115 |
QGesture::~QGesture() |
|
116 |
{ |
|
117 |
} |
|
118 |
||
119 |
/*! |
|
120 |
\property QGesture::state |
|
121 |
\brief the current state of the gesture |
|
122 |
*/ |
|
123 |
||
124 |
/*! |
|
125 |
\property QGesture::gestureType |
|
126 |
\brief the type of the gesture |
|
127 |
*/ |
|
128 |
||
129 |
/*! |
|
130 |
\property QGesture::hotSpot |
|
131 |
||
132 |
\brief The point that is used to find the receiver for the gesture event. |
|
133 |
||
134 |
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
|
135 |
QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a |
0 | 136 |
local hot-spot. |
137 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
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
|
139 |
delivery to a QGraphicsObject. |
0 | 140 |
*/ |
141 |
||
142 |
/*! |
|
143 |
\property QGesture::hasHotSpot |
|
144 |
\brief whether the gesture has a hot-spot |
|
145 |
*/ |
|
146 |
||
147 |
Qt::GestureType QGesture::gestureType() const |
|
148 |
{ |
|
149 |
return d_func()->gestureType; |
|
150 |
} |
|
151 |
||
152 |
Qt::GestureState QGesture::state() const |
|
153 |
{ |
|
154 |
return d_func()->state; |
|
155 |
} |
|
156 |
||
157 |
QPointF QGesture::hotSpot() const |
|
158 |
{ |
|
159 |
return d_func()->hotSpot; |
|
160 |
} |
|
161 |
||
162 |
void QGesture::setHotSpot(const QPointF &value) |
|
163 |
{ |
|
164 |
Q_D(QGesture); |
|
165 |
d->hotSpot = value; |
|
166 |
d->isHotSpotSet = true; |
|
167 |
} |
|
168 |
||
169 |
bool QGesture::hasHotSpot() const |
|
170 |
{ |
|
171 |
return d_func()->isHotSpotSet; |
|
172 |
} |
|
173 |
||
174 |
void QGesture::unsetHotSpot() |
|
175 |
{ |
|
176 |
d_func()->isHotSpotSet = false; |
|
177 |
} |
|
178 |
||
179 |
/*! |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
\property QGesture::gestureCancelPolicy |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
\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
|
182 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
183 |
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
|
184 |
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
|
185 |
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
|
186 |
context. For example for all child widgets. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
*/ |
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 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
190 |
\enum QGesture::GestureCancelPolicy |
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 |
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
|
193 |
automatically. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
195 |
\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
|
196 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
197 |
\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
|
198 |
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
|
199 |
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
|
200 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
201 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
void QGesture::setGestureCancelPolicy(GestureCancelPolicy 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 |
Q_D(QGesture); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
205 |
d->gestureCancelPolicy = static_cast<uint>(policy); |
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 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
208 |
QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const |
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 |
Q_D(const QGesture); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
211 |
return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
212 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
213 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
214 |
/*! |
0 | 215 |
\class QPanGesture |
216 |
\since 4.6 |
|
217 |
\brief The QPanGesture class describes a panning gesture made by the user. |
|
218 |
\ingroup gestures |
|
219 |
||
220 |
\image pangesture.png |
|
221 |
||
222 |
\sa {Gestures Programming}, QPinchGesture, QSwipeGesture |
|
223 |
*/ |
|
224 |
||
225 |
/*! |
|
226 |
\property QPanGesture::lastOffset |
|
227 |
\brief the last offset recorded for this gesture |
|
228 |
||
229 |
The last offset contains the change in position of the user's input as |
|
230 |
reported in the \l offset property when a previous gesture event was |
|
231 |
delivered for this gesture. |
|
232 |
||
233 |
If no previous event was delivered with information about this gesture |
|
234 |
(i.e., this gesture object contains information about the first movement |
|
235 |
in the gesture) then this property contains a zero size. |
|
236 |
*/ |
|
237 |
||
238 |
/*! |
|
239 |
\property QPanGesture::offset |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
240 |
\brief the total offset from the first input position to the current input |
0 | 241 |
position |
242 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
243 |
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
|
244 |
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
|
245 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
246 |
|
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 |
\property QPanGesture::delta |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
249 |
\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
|
250 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
251 |
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
|
252 |
lastOffset(). |
0 | 253 |
*/ |
254 |
||
255 |
/*! |
|
256 |
\property QPanGesture::acceleration |
|
257 |
*/ |
|
258 |
||
259 |
/*! |
|
260 |
\internal |
|
261 |
*/ |
|
262 |
QPanGesture::QPanGesture(QObject *parent) |
|
263 |
: QGesture(*new QPanGesturePrivate, parent) |
|
264 |
{ |
|
265 |
d_func()->gestureType = Qt::PanGesture; |
|
266 |
} |
|
267 |
||
268 |
||
269 |
QPointF QPanGesture::lastOffset() const |
|
270 |
{ |
|
271 |
return d_func()->lastOffset; |
|
272 |
} |
|
273 |
||
274 |
QPointF QPanGesture::offset() const |
|
275 |
{ |
|
276 |
return d_func()->offset; |
|
277 |
} |
|
278 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
279 |
QPointF QPanGesture::delta() const |
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 |
Q_D(const QPanGesture); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
282 |
return d->offset - d->lastOffset; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
283 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
284 |
|
0 | 285 |
qreal QPanGesture::acceleration() const |
286 |
{ |
|
287 |
return d_func()->acceleration; |
|
288 |
} |
|
289 |
||
290 |
void QPanGesture::setLastOffset(const QPointF &value) |
|
291 |
{ |
|
292 |
d_func()->lastOffset = value; |
|
293 |
} |
|
294 |
||
295 |
void QPanGesture::setOffset(const QPointF &value) |
|
296 |
{ |
|
297 |
d_func()->offset = value; |
|
298 |
} |
|
299 |
||
300 |
void QPanGesture::setAcceleration(qreal value) |
|
301 |
{ |
|
302 |
d_func()->acceleration = value; |
|
303 |
} |
|
304 |
||
305 |
/*! |
|
306 |
\class QPinchGesture |
|
307 |
\since 4.6 |
|
308 |
\brief The QPinchGesture class describes a pinch gesture made my the user. |
|
309 |
\ingroup multitouch |
|
310 |
\ingroup gestures |
|
311 |
||
312 |
A pinch gesture is a form of multitouch user input in which the user typically |
|
313 |
touches two points on the input device with a thumb and finger, before moving |
|
314 |
them closer together or further apart to change the scale factor, zoom, or level |
|
315 |
of detail of the user interface. |
|
316 |
||
317 |
\image pinchgesture.png |
|
318 |
||
319 |
Instead of repeatedly applying the same pinching gesture, the user may |
|
320 |
continue to touch the input device in one place, and apply a second touch |
|
321 |
to a new point, continuing the gesture. When this occurs, gesture events |
|
322 |
will continue to be delivered to the target object, containing an instance |
|
323 |
of QPinchGesture in the Qt::GestureUpdated state. |
|
324 |
||
325 |
\sa {Gestures Programming}, QPanGesture, QSwipeGesture |
|
326 |
*/ |
|
327 |
||
328 |
/*! |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
329 |
\enum QPinchGesture::ChangeFlag |
0 | 330 |
|
331 |
This enum describes the changes that can occur to the properties of |
|
332 |
the gesture object. |
|
333 |
||
334 |
\value ScaleFactorChanged The scale factor held by scaleFactor changed. |
|
335 |
\value RotationAngleChanged The rotation angle held by rotationAngle changed. |
|
336 |
\value CenterPointChanged The center point held by centerPoint changed. |
|
337 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
338 |
\sa changeFlags, totalChangeFlags |
0 | 339 |
*/ |
340 |
||
341 |
/*! |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
342 |
\property QPinchGesture::totalChangeFlags |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
343 |
\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
|
344 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
345 |
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
|
346 |
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
|
347 |
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
|
348 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
349 |
\sa changeFlags, scaleFactor, rotationAngle, centerPoint |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
350 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
351 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
352 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
353 |
\property QPinchGesture::changeFlags |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
354 |
\brief the property of the gesture that has changed in the current step |
0 | 355 |
|
356 |
This property indicates which of the other properties has changed since |
|
357 |
the previous gesture event included information about this gesture. You |
|
358 |
can use this information to determine which aspect of your user interface |
|
359 |
needs to be updated. |
|
360 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
361 |
\sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint |
0 | 362 |
*/ |
363 |
||
364 |
/*! |
|
365 |
\property QPinchGesture::totalScaleFactor |
|
366 |
\brief the total scale factor |
|
367 |
||
368 |
The total scale factor measures the total change in scale factor from the |
|
369 |
original value to the current scale factor. |
|
370 |
||
371 |
\sa scaleFactor, lastScaleFactor |
|
372 |
*/ |
|
373 |
/*! |
|
374 |
\property QPinchGesture::lastScaleFactor |
|
375 |
\brief the last scale factor recorded for this gesture |
|
376 |
||
377 |
The last scale factor contains the scale factor reported in the |
|
378 |
\l scaleFactor property when a previous gesture event included |
|
379 |
information about this gesture. |
|
380 |
||
381 |
If no previous event was delivered with information about this gesture |
|
382 |
(i.e., this gesture object contains information about the first movement |
|
383 |
in the gesture) then this property contains zero. |
|
384 |
||
385 |
\sa scaleFactor, totalScaleFactor |
|
386 |
*/ |
|
387 |
/*! |
|
388 |
\property QPinchGesture::scaleFactor |
|
389 |
\brief the current scale factor |
|
390 |
||
391 |
The scale factor measures the scale factor associated with the distance |
|
392 |
between two of the user's inputs on a multitouch device. |
|
393 |
||
394 |
\sa totalScaleFactor, lastScaleFactor |
|
395 |
*/ |
|
396 |
||
397 |
/*! |
|
398 |
\property QPinchGesture::totalRotationAngle |
|
399 |
\brief the total angle covered by the gesture |
|
400 |
||
401 |
This total angle measures the complete angle covered by the gesture. Usually, this |
|
402 |
is equal to the value held by the \l rotationAngle property, except in the case where |
|
403 |
the user performs multiple rotations by removing and repositioning one of the touch |
|
404 |
points, as described above. In this case, the total angle will be the sum of the |
|
405 |
rotation angles for the multiple stages of the gesture. |
|
406 |
||
407 |
\sa rotationAngle, lastRotationAngle |
|
408 |
*/ |
|
409 |
/*! |
|
410 |
\property QPinchGesture::lastRotationAngle |
|
411 |
\brief the last reported angle covered by the gesture motion |
|
412 |
||
413 |
The last rotation angle is the angle as reported in the \l rotationAngle property |
|
414 |
when a previous gesture event was delivered for this gesture. |
|
415 |
||
416 |
\sa rotationAngle, totalRotationAngle |
|
417 |
*/ |
|
418 |
/*! |
|
419 |
\property QPinchGesture::rotationAngle |
|
420 |
\brief the angle covered by the gesture motion |
|
421 |
||
422 |
\sa totalRotationAngle, lastRotationAngle |
|
423 |
*/ |
|
424 |
||
425 |
/*! |
|
426 |
\property QPinchGesture::startCenterPoint |
|
427 |
\brief the starting position of the center point |
|
428 |
||
429 |
\sa centerPoint, lastCenterPoint |
|
430 |
*/ |
|
431 |
/*! |
|
432 |
\property QPinchGesture::lastCenterPoint |
|
433 |
\brief the last position of the center point recorded for this gesture |
|
434 |
||
435 |
\sa centerPoint, startCenterPoint |
|
436 |
*/ |
|
437 |
/*! |
|
438 |
\property QPinchGesture::centerPoint |
|
439 |
\brief the current center point |
|
440 |
||
441 |
The center point is the midpoint between the two input points in the gesture. |
|
442 |
||
443 |
\sa startCenterPoint, lastCenterPoint |
|
444 |
*/ |
|
445 |
||
446 |
/*! |
|
447 |
\internal |
|
448 |
*/ |
|
449 |
QPinchGesture::QPinchGesture(QObject *parent) |
|
450 |
: QGesture(*new QPinchGesturePrivate, parent) |
|
451 |
{ |
|
452 |
d_func()->gestureType = Qt::PinchGesture; |
|
453 |
} |
|
454 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
455 |
QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const |
0 | 456 |
{ |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
457 |
return d_func()->totalChangeFlags; |
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 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
461 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
462 |
d_func()->totalChangeFlags = value; |
0 | 463 |
} |
464 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
465 |
QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const |
0 | 466 |
{ |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
return d_func()->changeFlags; |
0 | 468 |
} |
469 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
471 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
472 |
d_func()->changeFlags = value; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
473 |
} |
0 | 474 |
|
475 |
QPointF QPinchGesture::startCenterPoint() const |
|
476 |
{ |
|
477 |
return d_func()->startCenterPoint; |
|
478 |
} |
|
479 |
||
480 |
QPointF QPinchGesture::lastCenterPoint() const |
|
481 |
{ |
|
482 |
return d_func()->lastCenterPoint; |
|
483 |
} |
|
484 |
||
485 |
QPointF QPinchGesture::centerPoint() const |
|
486 |
{ |
|
487 |
return d_func()->centerPoint; |
|
488 |
} |
|
489 |
||
490 |
void QPinchGesture::setStartCenterPoint(const QPointF &value) |
|
491 |
{ |
|
492 |
d_func()->startCenterPoint = value; |
|
493 |
} |
|
494 |
||
495 |
void QPinchGesture::setLastCenterPoint(const QPointF &value) |
|
496 |
{ |
|
497 |
d_func()->lastCenterPoint = value; |
|
498 |
} |
|
499 |
||
500 |
void QPinchGesture::setCenterPoint(const QPointF &value) |
|
501 |
{ |
|
502 |
d_func()->centerPoint = value; |
|
503 |
} |
|
504 |
||
505 |
||
506 |
qreal QPinchGesture::totalScaleFactor() const |
|
507 |
{ |
|
508 |
return d_func()->totalScaleFactor; |
|
509 |
} |
|
510 |
||
511 |
qreal QPinchGesture::lastScaleFactor() const |
|
512 |
{ |
|
513 |
return d_func()->lastScaleFactor; |
|
514 |
} |
|
515 |
||
516 |
qreal QPinchGesture::scaleFactor() const |
|
517 |
{ |
|
518 |
return d_func()->scaleFactor; |
|
519 |
} |
|
520 |
||
521 |
void QPinchGesture::setTotalScaleFactor(qreal value) |
|
522 |
{ |
|
523 |
d_func()->totalScaleFactor = value; |
|
524 |
} |
|
525 |
||
526 |
void QPinchGesture::setLastScaleFactor(qreal value) |
|
527 |
{ |
|
528 |
d_func()->lastScaleFactor = value; |
|
529 |
} |
|
530 |
||
531 |
void QPinchGesture::setScaleFactor(qreal value) |
|
532 |
{ |
|
533 |
d_func()->scaleFactor = value; |
|
534 |
} |
|
535 |
||
536 |
||
537 |
qreal QPinchGesture::totalRotationAngle() const |
|
538 |
{ |
|
539 |
return d_func()->totalRotationAngle; |
|
540 |
} |
|
541 |
||
542 |
qreal QPinchGesture::lastRotationAngle() const |
|
543 |
{ |
|
544 |
return d_func()->lastRotationAngle; |
|
545 |
} |
|
546 |
||
547 |
qreal QPinchGesture::rotationAngle() const |
|
548 |
{ |
|
549 |
return d_func()->rotationAngle; |
|
550 |
} |
|
551 |
||
552 |
void QPinchGesture::setTotalRotationAngle(qreal value) |
|
553 |
{ |
|
554 |
d_func()->totalRotationAngle = value; |
|
555 |
} |
|
556 |
||
557 |
void QPinchGesture::setLastRotationAngle(qreal value) |
|
558 |
{ |
|
559 |
d_func()->lastRotationAngle = value; |
|
560 |
} |
|
561 |
||
562 |
void QPinchGesture::setRotationAngle(qreal value) |
|
563 |
{ |
|
564 |
d_func()->rotationAngle = value; |
|
565 |
} |
|
566 |
||
567 |
/*! |
|
568 |
\class QSwipeGesture |
|
569 |
\since 4.6 |
|
570 |
\brief The QSwipeGesture class describes a swipe gesture made by the user. |
|
571 |
\ingroup gestures |
|
572 |
||
573 |
\image swipegesture.png |
|
574 |
||
575 |
\sa {Gestures Programming}, QPanGesture, QPinchGesture |
|
576 |
*/ |
|
577 |
||
578 |
/*! |
|
579 |
\enum QSwipeGesture::SwipeDirection |
|
580 |
||
581 |
This enum describes the possible directions for the gesture's motion |
|
582 |
along the horizontal and vertical axes. |
|
583 |
||
584 |
\value NoDirection The gesture had no motion associated with it on a particular axis. |
|
585 |
\value Left The gesture involved a horizontal motion to the left. |
|
586 |
\value Right The gesture involved a horizontal motion to the right. |
|
587 |
\value Up The gesture involved an upward vertical motion. |
|
588 |
\value Down The gesture involved a downward vertical motion. |
|
589 |
*/ |
|
590 |
||
591 |
/*! |
|
592 |
\property QSwipeGesture::horizontalDirection |
|
593 |
\brief the horizontal direction of the gesture |
|
594 |
||
595 |
If the gesture has a horizontal component, the horizontal direction |
|
596 |
is either Left or Right; otherwise, it is NoDirection. |
|
597 |
||
598 |
\sa verticalDirection, swipeAngle |
|
599 |
*/ |
|
600 |
||
601 |
/*! |
|
602 |
\property QSwipeGesture::verticalDirection |
|
603 |
\brief the vertical direction of the gesture |
|
604 |
||
605 |
If the gesture has a vertical component, the vertical direction |
|
606 |
is either Up or Down; otherwise, it is NoDirection. |
|
607 |
||
608 |
\sa horizontalDirection, swipeAngle |
|
609 |
*/ |
|
610 |
||
611 |
/*! |
|
612 |
\property QSwipeGesture::swipeAngle |
|
613 |
\brief the angle of the motion associated with the gesture |
|
614 |
||
615 |
If the gesture has either a horizontal or vertical component, the |
|
616 |
swipe angle describes the angle between the direction of motion and the |
|
617 |
x-axis as defined using the standard widget |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
618 |
\l{Coordinate System}{coordinate system}. |
0 | 619 |
|
620 |
\sa horizontalDirection, verticalDirection |
|
621 |
*/ |
|
622 |
||
623 |
/*! |
|
624 |
\internal |
|
625 |
*/ |
|
626 |
QSwipeGesture::QSwipeGesture(QObject *parent) |
|
627 |
: QGesture(*new QSwipeGesturePrivate, parent) |
|
628 |
{ |
|
629 |
d_func()->gestureType = Qt::SwipeGesture; |
|
630 |
} |
|
631 |
||
632 |
QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const |
|
633 |
{ |
|
634 |
Q_D(const QSwipeGesture); |
|
635 |
if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270) |
|
636 |
return QSwipeGesture::NoDirection; |
|
637 |
else if (d->swipeAngle < 90 || d->swipeAngle > 270) |
|
638 |
return QSwipeGesture::Right; |
|
639 |
else |
|
640 |
return QSwipeGesture::Left; |
|
641 |
} |
|
642 |
||
643 |
QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const |
|
644 |
{ |
|
645 |
Q_D(const QSwipeGesture); |
|
646 |
if (d->swipeAngle <= 0 || d->swipeAngle == 180) |
|
647 |
return QSwipeGesture::NoDirection; |
|
648 |
else if (d->swipeAngle < 180) |
|
649 |
return QSwipeGesture::Up; |
|
650 |
else |
|
651 |
return QSwipeGesture::Down; |
|
652 |
} |
|
653 |
||
654 |
qreal QSwipeGesture::swipeAngle() const |
|
655 |
{ |
|
656 |
return d_func()->swipeAngle; |
|
657 |
} |
|
658 |
||
659 |
void QSwipeGesture::setSwipeAngle(qreal value) |
|
660 |
{ |
|
661 |
d_func()->swipeAngle = value; |
|
662 |
} |
|
663 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
664 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
665 |
\class QTapGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
666 |
\since 4.6 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
667 |
\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
|
668 |
\ingroup gestures |
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 |
\sa {Gestures Programming}, QPanGesture, QPinchGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
671 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
672 |
|
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 |
\property QTapGesture::position |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
675 |
\brief the position of the tap |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
676 |
*/ |
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 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
679 |
\internal |
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 |
QTapGesture::QTapGesture(QObject *parent) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
: QGesture(*new QTapGesturePrivate, parent) |
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 |
d_func()->gestureType = Qt::TapGesture; |
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 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
687 |
QPointF QTapGesture::position() const |
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 |
return d_func()->position; |
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 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
692 |
void QTapGesture::setPosition(const QPointF &value) |
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 |
d_func()->position = value; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
695 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
696 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
697 |
\class QTapAndHoldGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
698 |
\since 4.6 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
699 |
\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
|
700 |
gesture made by the user. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
701 |
\ingroup gestures |
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 |
\sa {Gestures Programming}, QPanGesture, QPinchGesture |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
704 |
*/ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
705 |
|
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 |
\property QTapAndHoldGesture::position |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
708 |
\brief the position of the tap |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
709 |
*/ |
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 |
/*! |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
712 |
\internal |
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 |
QTapAndHoldGesture::QTapAndHoldGesture(QObject *parent) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
715 |
: QGesture(*new QTapAndHoldGesturePrivate, parent) |
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 |
d_func()->gestureType = Qt::TapAndHoldGesture; |
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 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
720 |
QPointF QTapAndHoldGesture::position() const |
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 |
return d_func()->position; |
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 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
725 |
void QTapAndHoldGesture::setPosition(const QPointF &value) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
726 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
727 |
d_func()->position = value; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
728 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
729 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
730 |
/*! |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
731 |
Set the timeout, in milliseconds, before the gesture triggers. |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
732 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
733 |
The recognizer will detect a touch down and and if \a msecs |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
734 |
later the touch is still down, it will trigger the QTapAndHoldGesture. |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
735 |
The default value is 700 milliseconds. |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
736 |
*/ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
737 |
// static |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
738 |
void QTapAndHoldGesture::setTimeout(int msecs) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
739 |
{ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
740 |
QTapAndHoldGesturePrivate::Timeout = msecs; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
741 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
742 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
743 |
/*! |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
744 |
Gets the timeout, in milliseconds, before the gesture triggers. |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
745 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
746 |
The recognizer will detect a touch down and and if timeout() |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
747 |
later the touch is still down, it will trigger the QTapAndHoldGesture. |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
748 |
The default value is 700 milliseconds. |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
749 |
*/ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
750 |
// static |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
751 |
int QTapAndHoldGesture::timeout() |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
752 |
{ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
753 |
return QTapAndHoldGesturePrivate::Timeout; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
754 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
755 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
756 |
int QTapAndHoldGesturePrivate::Timeout = 700; // in ms |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
757 |
|
0 | 758 |
QT_END_NAMESPACE |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
759 |
|
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
760 |
#endif // QT_NO_GESTURES |