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