| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qgesture.h" | - |
| 43 | #include "private/qgesture_p.h" | - |
| 44 | #include "private/qstandardgestures_p.h" | - |
| 45 | #include "qgraphicsview.h" | - |
| 46 | | - |
| 47 | #ifndef QT_NO_GESTURES | - |
| 48 | | - |
| 49 | QT_BEGIN_NAMESPACE | - |
| 50 | | - |
| 51 | /*! | - |
| 52 | \class QGesture | - |
| 53 | \since 4.6 | - |
| 54 | \ingroup gestures | - |
| 55 | \inmodule QtWidgets | - |
| 56 | | - |
| 57 | \brief The QGesture class represents a gesture, containing properties that | - |
| 58 | describe the corresponding user input. | - |
| 59 | | - |
| 60 | Gesture objects are not constructed directly by developers. They are created by | - |
| 61 | the QGestureRecognizer object that is registered with the application; see | - |
| 62 | QGestureRecognizer::registerRecognizer(). | - |
| 63 | | - |
| 64 | For an overview of gesture handling in Qt and information on using gestures | - |
| 65 | in your applications, see the \l{Gestures in Widgets and Graphics View} document. | - |
| 66 | | - |
| 67 | \section1 Gesture Properties | - |
| 68 | | - |
| 69 | The class has a list of properties that can be queried by the user to get | - |
| 70 | some gesture-specific arguments. For example, the pinch gesture has a scale | - |
| 71 | factor that is exposed as a property. | - |
| 72 | | - |
| 73 | Developers of custom gesture recognizers can add additional properties in | - |
| 74 | order to provide additional information about a gesture. This can be done | - |
| 75 | by adding new dynamic properties to a QGesture object, or by subclassing | - |
| 76 | the QGesture class (or one of its subclasses). | - |
| 77 | | - |
| 78 | \section1 Lifecycle of a Gesture Object | - |
| 79 | | - |
| 80 | A QGesture instance is implicitly created when needed and is owned by Qt. | - |
| 81 | Developers should never destroy them or store them for later use as Qt may | - |
| 82 | destroy particular instances of them and create new ones to replace them. | - |
| 83 | | - |
| 84 | The registered gesture recognizer monitors the input events for the target | - |
| 85 | object via its \l{QGestureRecognizer::}{recognize()} function, updating the | - |
| 86 | properties of the gesture object as required. | - |
| 87 | | - |
| 88 | The gesture object may be delivered to the target object in a QGestureEvent if | - |
| 89 | the corresponding gesture is active or has just been canceled. Each event that | - |
| 90 | is delivered contains a list of gesture objects, since support for more than | - |
| 91 | one gesture may be enabled for the target object. Due to the way events are | - |
| 92 | handled in Qt, gesture events may be filtered by other objects. | - |
| 93 | | - |
| 94 | \sa QGestureEvent, QGestureRecognizer | - |
| 95 | */ | - |
| 96 | | - |
| 97 | /*! | - |
| 98 | Constructs a new gesture object with the given \a parent. | - |
| 99 | | - |
| 100 | QGesture objects are created by gesture recognizers in the | - |
| 101 | QGestureRecognizer::create() function. | - |
| 102 | */ | - |
| 103 | QGesture::QGesture(QObject *parent) | - |
| 104 | : QObject(*new QGesturePrivate, parent) | - |
| 105 | { | - |
| 106 | d_func()->gestureType = Qt::CustomGesture; executed (the execution status of this line is deduced): d_func()->gestureType = Qt::CustomGesture; | - |
| 107 | } executed: }Execution Count:129 | 129 |
| 108 | | - |
| 109 | /*! | - |
| 110 | \internal | - |
| 111 | */ | - |
| 112 | QGesture::QGesture(QGesturePrivate &dd, QObject *parent) | - |
| 113 | : QObject(dd, parent) | - |
| 114 | { | - |
| 115 | } executed: }Execution Count:5405 | 5405 |
| 116 | | - |
| 117 | /*! | - |
| 118 | Destroys the gesture object. | - |
| 119 | */ | - |
| 120 | QGesture::~QGesture() | - |
| 121 | { | - |
| 122 | } | - |
| 123 | | - |
| 124 | /*! | - |
| 125 | \property QGesture::state | - |
| 126 | \brief the current state of the gesture | - |
| 127 | */ | - |
| 128 | | - |
| 129 | /*! | - |
| 130 | \property QGesture::gestureType | - |
| 131 | \brief the type of the gesture | - |
| 132 | */ | - |
| 133 | | - |
| 134 | /*! | - |
| 135 | \property QGesture::hotSpot | - |
| 136 | | - |
| 137 | \brief The point that is used to find the receiver for the gesture event. | - |
| 138 | | - |
| 139 | The hot-spot is a point in the global coordinate system, use | - |
| 140 | QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a | - |
| 141 | local hot-spot. | - |
| 142 | | - |
| 143 | The hot-spot should be set by the gesture recognizer to allow gesture event | - |
| 144 | delivery to a QGraphicsObject. | - |
| 145 | */ | - |
| 146 | | - |
| 147 | /*! | - |
| 148 | \property QGesture::hasHotSpot | - |
| 149 | \brief whether the gesture has a hot-spot | - |
| 150 | */ | - |
| 151 | | - |
| 152 | Qt::GestureType QGesture::gestureType() const | - |
| 153 | { | - |
| 154 | return d_func()->gestureType; executed: return d_func()->gestureType;Execution Count:9077 | 9077 |
| 155 | } | - |
| 156 | | - |
| 157 | Qt::GestureState QGesture::state() const | - |
| 158 | { | - |
| 159 | return d_func()->state; executed: return d_func()->state;Execution Count:1798 | 1798 |
| 160 | } | - |
| 161 | | - |
| 162 | QPointF QGesture::hotSpot() const | - |
| 163 | { | - |
| 164 | return d_func()->hotSpot; executed: return d_func()->hotSpot;Execution Count:192 | 192 |
| 165 | } | - |
| 166 | | - |
| 167 | void QGesture::setHotSpot(const QPointF &value) | - |
| 168 | { | - |
| 169 | Q_D(QGesture); executed (the execution status of this line is deduced): QGesturePrivate * const d = d_func(); | - |
| 170 | d->hotSpot = value; executed (the execution status of this line is deduced): d->hotSpot = value; | - |
| 171 | d->isHotSpotSet = true; executed (the execution status of this line is deduced): d->isHotSpotSet = true; | - |
| 172 | } executed: }Execution Count:226 | 226 |
| 173 | | - |
| 174 | bool QGesture::hasHotSpot() const | - |
| 175 | { | - |
| 176 | return d_func()->isHotSpotSet; executed: return d_func()->isHotSpotSet;Execution Count:297 | 297 |
| 177 | } | - |
| 178 | | - |
| 179 | void QGesture::unsetHotSpot() | - |
| 180 | { | - |
| 181 | d_func()->isHotSpotSet = false; never executed (the execution status of this line is deduced): d_func()->isHotSpotSet = false; | - |
| 182 | } | 0 |
| 183 | | - |
| 184 | /*! | - |
| 185 | \property QGesture::gestureCancelPolicy | - |
| 186 | \brief the policy for deciding what happens on accepting a gesture | - |
| 187 | | - |
| 188 | On accepting one gesture Qt can automatically cancel other gestures | - |
| 189 | that belong to other targets. The policy is normally set to not cancel | - |
| 190 | any other gestures and can be set to cancel all active gestures in the | - |
| 191 | context. For example for all child widgets. | - |
| 192 | */ | - |
| 193 | | - |
| 194 | /*! | - |
| 195 | \enum QGesture::GestureCancelPolicy | - |
| 196 | | - |
| 197 | This enum describes how accepting a gesture can cancel other gestures | - |
| 198 | automatically. | - |
| 199 | | - |
| 200 | \value CancelNone On accepting this gesture no other gestures will be affected. | - |
| 201 | | - |
| 202 | \value CancelAllInContext On accepting this gesture all gestures that are | - |
| 203 | active in the context (respecting the Qt::GestureFlag that were specified | - |
| 204 | when subscribed to the gesture) will be cancelled. | - |
| 205 | */ | - |
| 206 | | - |
| 207 | void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy) | - |
| 208 | { | - |
| 209 | Q_D(QGesture); executed (the execution status of this line is deduced): QGesturePrivate * const d = d_func(); | - |
| 210 | d->gestureCancelPolicy = static_cast<uint>(policy); executed (the execution status of this line is deduced): d->gestureCancelPolicy = static_cast<uint>(policy); | - |
| 211 | } executed: }Execution Count:92 | 92 |
| 212 | | - |
| 213 | QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const | - |
| 214 | { | - |
| 215 | Q_D(const QGesture); executed (the execution status of this line is deduced): const QGesturePrivate * const d = d_func(); | - |
| 216 | return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy); executed: return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy);Execution Count:110 | 110 |
| 217 | } | - |
| 218 | | - |
| 219 | /*! | - |
| 220 | \class QPanGesture | - |
| 221 | \since 4.6 | - |
| 222 | \brief The QPanGesture class describes a panning gesture made by the user. | - |
| 223 | \ingroup gestures | - |
| 224 | \inmodule QtWidgets | - |
| 225 | | - |
| 226 | \image pangesture.png | - |
| 227 | | - |
| 228 | For an overview of gesture handling in Qt and information on using gestures | - |
| 229 | in your applications, see the \l{Gestures in Widgets and Graphics View} document. | - |
| 230 | | - |
| 231 | \sa QPinchGesture, QSwipeGesture | - |
| 232 | */ | - |
| 233 | | - |
| 234 | /*! | - |
| 235 | \property QPanGesture::lastOffset | - |
| 236 | \brief the last offset recorded for this gesture | - |
| 237 | | - |
| 238 | The last offset contains the change in position of the user's input as | - |
| 239 | reported in the \l offset property when a previous gesture event was | - |
| 240 | delivered for this gesture. | - |
| 241 | | - |
| 242 | If no previous event was delivered with information about this gesture | - |
| 243 | (i.e., this gesture object contains information about the first movement | - |
| 244 | in the gesture) then this property contains a zero size. | - |
| 245 | */ | - |
| 246 | | - |
| 247 | /*! | - |
| 248 | \property QPanGesture::offset | - |
| 249 | \brief the total offset from the first input position to the current input | - |
| 250 | position | - |
| 251 | | - |
| 252 | The offset measures the total change in position of the user's input | - |
| 253 | covered by the gesture on the input device. | - |
| 254 | */ | - |
| 255 | | - |
| 256 | /*! | - |
| 257 | \property QPanGesture::delta | - |
| 258 | \brief the offset from the previous input position to the current input | - |
| 259 | | - |
| 260 | This is essentially the same as the difference between offset() and | - |
| 261 | lastOffset(). | - |
| 262 | */ | - |
| 263 | | - |
| 264 | /*! | - |
| 265 | \property QPanGesture::acceleration | - |
| 266 | \brief the acceleration in the motion of the touch point for this gesture | - |
| 267 | */ | - |
| 268 | | - |
| 269 | /*! | - |
| 270 | \property QPanGesture::horizontalVelocity | - |
| 271 | \brief the horizontal component of the motion of the touch point for this | - |
| 272 | gesture | - |
| 273 | \since 4.7.1 | - |
| 274 | \internal | - |
| 275 | | - |
| 276 | \sa verticalVelocity, acceleration | - |
| 277 | */ | - |
| 278 | | - |
| 279 | /*! | - |
| 280 | \property QPanGesture::verticalVelocity | - |
| 281 | \brief the vertical component of the motion of the touch point for this | - |
| 282 | gesture | - |
| 283 | \since 4.7.1 | - |
| 284 | \internal | - |
| 285 | | - |
| 286 | \sa horizontalVelocity, acceleration | - |
| 287 | */ | - |
| 288 | | - |
| 289 | /*! | - |
| 290 | \internal | - |
| 291 | */ | - |
| 292 | QPanGesture::QPanGesture(QObject *parent) | - |
| 293 | : QGesture(*new QPanGesturePrivate, parent) | - |
| 294 | { | - |
| 295 | d_func()->gestureType = Qt::PanGesture; executed (the execution status of this line is deduced): d_func()->gestureType = Qt::PanGesture; | - |
| 296 | } executed: }Execution Count:5176 | 5176 |
| 297 | | - |
| 298 | /*! | - |
| 299 | Destructor. | - |
| 300 | */ | - |
| 301 | QPanGesture::~QPanGesture() | - |
| 302 | { | - |
| 303 | } | - |
| 304 | | - |
| 305 | QPointF QPanGesture::lastOffset() const | - |
| 306 | { | - |
| 307 | return d_func()->lastOffset; never executed: return d_func()->lastOffset; | 0 |
| 308 | } | - |
| 309 | | - |
| 310 | QPointF QPanGesture::offset() const | - |
| 311 | { | - |
| 312 | return d_func()->offset; never executed: return d_func()->offset; | 0 |
| 313 | } | - |
| 314 | | - |
| 315 | QPointF QPanGesture::delta() const | - |
| 316 | { | - |
| 317 | Q_D(const QPanGesture); never executed (the execution status of this line is deduced): const QPanGesturePrivate * const d = d_func(); | - |
| 318 | return d->offset - d->lastOffset; never executed: return d->offset - d->lastOffset; | 0 |
| 319 | } | - |
| 320 | | - |
| 321 | qreal QPanGesture::acceleration() const | - |
| 322 | { | - |
| 323 | return d_func()->acceleration; never executed: return d_func()->acceleration; | 0 |
| 324 | } | - |
| 325 | | - |
| 326 | void QPanGesture::setLastOffset(const QPointF &value) | - |
| 327 | { | - |
| 328 | d_func()->lastOffset = value; never executed (the execution status of this line is deduced): d_func()->lastOffset = value; | - |
| 329 | } | 0 |
| 330 | | - |
| 331 | void QPanGesture::setOffset(const QPointF &value) | - |
| 332 | { | - |
| 333 | d_func()->offset = value; never executed (the execution status of this line is deduced): d_func()->offset = value; | - |
| 334 | } | 0 |
| 335 | | - |
| 336 | void QPanGesture::setAcceleration(qreal value) | - |
| 337 | { | - |
| 338 | d_func()->acceleration = value; never executed (the execution status of this line is deduced): d_func()->acceleration = value; | - |
| 339 | } | 0 |
| 340 | | - |
| 341 | /*! | - |
| 342 | \class QPinchGesture | - |
| 343 | \since 4.6 | - |
| 344 | \brief The QPinchGesture class describes a pinch gesture made by the user. | - |
| 345 | \ingroup touch | - |
| 346 | \ingroup gestures | - |
| 347 | \inmodule QtWidgets | - |
| 348 | | - |
| 349 | A pinch gesture is a form of touch user input in which the user typically | - |
| 350 | touches two points on the input device with a thumb and finger, before moving | - |
| 351 | them closer together or further apart to change the scale factor, zoom, or level | - |
| 352 | of detail of the user interface. | - |
| 353 | | - |
| 354 | For an overview of gesture handling in Qt and information on using gestures | - |
| 355 | in your applications, see the \l{Gestures in Widgets and Graphics View} document. | - |
| 356 | | - |
| 357 | \image pinchgesture.png | - |
| 358 | | - |
| 359 | Instead of repeatedly applying the same pinching gesture, the user may | - |
| 360 | continue to touch the input device in one place, and apply a second touch | - |
| 361 | to a new point, continuing the gesture. When this occurs, gesture events | - |
| 362 | will continue to be delivered to the target object, containing an instance | - |
| 363 | of QPinchGesture in the Qt::GestureUpdated state. | - |
| 364 | | - |
| 365 | \sa QPanGesture, QSwipeGesture | - |
| 366 | */ | - |
| 367 | | - |
| 368 | /*! | - |
| 369 | \enum QPinchGesture::ChangeFlag | - |
| 370 | | - |
| 371 | This enum describes the changes that can occur to the properties of | - |
| 372 | the gesture object. | - |
| 373 | | - |
| 374 | \value ScaleFactorChanged The scale factor held by scaleFactor changed. | - |
| 375 | \value RotationAngleChanged The rotation angle held by rotationAngle changed. | - |
| 376 | \value CenterPointChanged The center point held by centerPoint changed. | - |
| 377 | | - |
| 378 | \sa changeFlags, totalChangeFlags | - |
| 379 | */ | - |
| 380 | | - |
| 381 | /*! | - |
| 382 | \property QPinchGesture::totalChangeFlags | - |
| 383 | \brief the property of the gesture that has change | - |
| 384 | | - |
| 385 | This property indicates which of the other properties has changed since the | - |
| 386 | gesture has started. You can use this information to determine which aspect | - |
| 387 | of your user interface needs to be updated. | - |
| 388 | | - |
| 389 | \sa changeFlags, scaleFactor, rotationAngle, centerPoint | - |
| 390 | */ | - |
| 391 | | - |
| 392 | /*! | - |
| 393 | \property QPinchGesture::changeFlags | - |
| 394 | \brief the property of the gesture that has changed in the current step | - |
| 395 | | - |
| 396 | This property indicates which of the other properties has changed since | - |
| 397 | the previous gesture event included information about this gesture. You | - |
| 398 | can use this information to determine which aspect of your user interface | - |
| 399 | needs to be updated. | - |
| 400 | | - |
| 401 | \sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint | - |
| 402 | */ | - |
| 403 | | - |
| 404 | /*! | - |
| 405 | \property QPinchGesture::totalScaleFactor | - |
| 406 | \brief the total scale factor | - |
| 407 | | - |
| 408 | The total scale factor measures the total change in scale factor from the | - |
| 409 | original value to the current scale factor. | - |
| 410 | | - |
| 411 | \sa scaleFactor, lastScaleFactor | - |
| 412 | */ | - |
| 413 | /*! | - |
| 414 | \property QPinchGesture::lastScaleFactor | - |
| 415 | \brief the last scale factor recorded for this gesture | - |
| 416 | | - |
| 417 | The last scale factor contains the scale factor reported in the | - |
| 418 | \l scaleFactor property when a previous gesture event included | - |
| 419 | information about this gesture. | - |
| 420 | | - |
| 421 | If no previous event was delivered with information about this gesture | - |
| 422 | (i.e., this gesture object contains information about the first movement | - |
| 423 | in the gesture) then this property contains zero. | - |
| 424 | | - |
| 425 | \sa scaleFactor, totalScaleFactor | - |
| 426 | */ | - |
| 427 | /*! | - |
| 428 | \property QPinchGesture::scaleFactor | - |
| 429 | \brief the current scale factor | - |
| 430 | | - |
| 431 | The scale factor measures the scale factor associated with the distance | - |
| 432 | between two of the user's inputs on a touch device. | - |
| 433 | | - |
| 434 | \sa totalScaleFactor, lastScaleFactor | - |
| 435 | */ | - |
| 436 | | - |
| 437 | /*! | - |
| 438 | \property QPinchGesture::totalRotationAngle | - |
| 439 | \brief the total angle covered by the gesture | - |
| 440 | | - |
| 441 | This total angle measures the complete angle covered by the gesture. Usually, this | - |
| 442 | is equal to the value held by the \l rotationAngle property, except in the case where | - |
| 443 | the user performs multiple rotations by removing and repositioning one of the touch | - |
| 444 | points, as described above. In this case, the total angle will be the sum of the | - |
| 445 | rotation angles for the multiple stages of the gesture. | - |
| 446 | | - |
| 447 | \sa rotationAngle, lastRotationAngle | - |
| 448 | */ | - |
| 449 | /*! | - |
| 450 | \property QPinchGesture::lastRotationAngle | - |
| 451 | \brief the last reported angle covered by the gesture motion | - |
| 452 | | - |
| 453 | The last rotation angle is the angle as reported in the \l rotationAngle property | - |
| 454 | when a previous gesture event was delivered for this gesture. | - |
| 455 | | - |
| 456 | \sa rotationAngle, totalRotationAngle | - |
| 457 | */ | - |
| 458 | /*! | - |
| 459 | \property QPinchGesture::rotationAngle | - |
| 460 | \brief the angle covered by the gesture motion | - |
| 461 | | - |
| 462 | \sa totalRotationAngle, lastRotationAngle | - |
| 463 | */ | - |
| 464 | | - |
| 465 | /*! | - |
| 466 | \property QPinchGesture::startCenterPoint | - |
| 467 | \brief the starting position of the center point | - |
| 468 | | - |
| 469 | \sa centerPoint, lastCenterPoint | - |
| 470 | */ | - |
| 471 | /*! | - |
| 472 | \property QPinchGesture::lastCenterPoint | - |
| 473 | \brief the last position of the center point recorded for this gesture | - |
| 474 | | - |
| 475 | \sa centerPoint, startCenterPoint | - |
| 476 | */ | - |
| 477 | /*! | - |
| 478 | \property QPinchGesture::centerPoint | - |
| 479 | \brief the current center point | - |
| 480 | | - |
| 481 | The center point is the midpoint between the two input points in the gesture. | - |
| 482 | | - |
| 483 | \sa startCenterPoint, lastCenterPoint | - |
| 484 | */ | - |
| 485 | | - |
| 486 | /*! | - |
| 487 | \internal | - |
| 488 | */ | - |
| 489 | QPinchGesture::QPinchGesture(QObject *parent) | - |
| 490 | : QGesture(*new QPinchGesturePrivate, parent) | - |
| 491 | { | - |
| 492 | d_func()->gestureType = Qt::PinchGesture; executed (the execution status of this line is deduced): d_func()->gestureType = Qt::PinchGesture; | - |
| 493 | } executed: }Execution Count:56 | 56 |
| 494 | | - |
| 495 | /*! | - |
| 496 | Destructor. | - |
| 497 | */ | - |
| 498 | QPinchGesture::~QPinchGesture() | - |
| 499 | { | - |
| 500 | } | - |
| 501 | | - |
| 502 | QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const | - |
| 503 | { | - |
| 504 | return d_func()->totalChangeFlags; never executed: return d_func()->totalChangeFlags; | 0 |
| 505 | } | - |
| 506 | | - |
| 507 | void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value) | - |
| 508 | { | - |
| 509 | d_func()->totalChangeFlags = value; never executed (the execution status of this line is deduced): d_func()->totalChangeFlags = value; | - |
| 510 | } | 0 |
| 511 | | - |
| 512 | QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const | - |
| 513 | { | - |
| 514 | return d_func()->changeFlags; never executed: return d_func()->changeFlags; | 0 |
| 515 | } | - |
| 516 | | - |
| 517 | void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value) | - |
| 518 | { | - |
| 519 | d_func()->changeFlags = value; never executed (the execution status of this line is deduced): d_func()->changeFlags = value; | - |
| 520 | } | 0 |
| 521 | | - |
| 522 | QPointF QPinchGesture::startCenterPoint() const | - |
| 523 | { | - |
| 524 | return d_func()->startCenterPoint; never executed: return d_func()->startCenterPoint; | 0 |
| 525 | } | - |
| 526 | | - |
| 527 | QPointF QPinchGesture::lastCenterPoint() const | - |
| 528 | { | - |
| 529 | return d_func()->lastCenterPoint; never executed: return d_func()->lastCenterPoint; | 0 |
| 530 | } | - |
| 531 | | - |
| 532 | QPointF QPinchGesture::centerPoint() const | - |
| 533 | { | - |
| 534 | return d_func()->centerPoint; never executed: return d_func()->centerPoint; | 0 |
| 535 | } | - |
| 536 | | - |
| 537 | void QPinchGesture::setStartCenterPoint(const QPointF &value) | - |
| 538 | { | - |
| 539 | d_func()->startCenterPoint = value; never executed (the execution status of this line is deduced): d_func()->startCenterPoint = value; | - |
| 540 | } | 0 |
| 541 | | - |
| 542 | void QPinchGesture::setLastCenterPoint(const QPointF &value) | - |
| 543 | { | - |
| 544 | d_func()->lastCenterPoint = value; never executed (the execution status of this line is deduced): d_func()->lastCenterPoint = value; | - |
| 545 | } | 0 |
| 546 | | - |
| 547 | void QPinchGesture::setCenterPoint(const QPointF &value) | - |
| 548 | { | - |
| 549 | d_func()->centerPoint = value; never executed (the execution status of this line is deduced): d_func()->centerPoint = value; | - |
| 550 | } | 0 |
| 551 | | - |
| 552 | | - |
| 553 | qreal QPinchGesture::totalScaleFactor() const | - |
| 554 | { | - |
| 555 | return d_func()->totalScaleFactor; never executed: return d_func()->totalScaleFactor; | 0 |
| 556 | } | - |
| 557 | | - |
| 558 | qreal QPinchGesture::lastScaleFactor() const | - |
| 559 | { | - |
| 560 | return d_func()->lastScaleFactor; never executed: return d_func()->lastScaleFactor; | 0 |
| 561 | } | - |
| 562 | | - |
| 563 | qreal QPinchGesture::scaleFactor() const | - |
| 564 | { | - |
| 565 | return d_func()->scaleFactor; never executed: return d_func()->scaleFactor; | 0 |
| 566 | } | - |
| 567 | | - |
| 568 | void QPinchGesture::setTotalScaleFactor(qreal value) | - |
| 569 | { | - |
| 570 | d_func()->totalScaleFactor = value; never executed (the execution status of this line is deduced): d_func()->totalScaleFactor = value; | - |
| 571 | } | 0 |
| 572 | | - |
| 573 | void QPinchGesture::setLastScaleFactor(qreal value) | - |
| 574 | { | - |
| 575 | d_func()->lastScaleFactor = value; never executed (the execution status of this line is deduced): d_func()->lastScaleFactor = value; | - |
| 576 | } | 0 |
| 577 | | - |
| 578 | void QPinchGesture::setScaleFactor(qreal value) | - |
| 579 | { | - |
| 580 | d_func()->scaleFactor = value; never executed (the execution status of this line is deduced): d_func()->scaleFactor = value; | - |
| 581 | } | 0 |
| 582 | | - |
| 583 | | - |
| 584 | qreal QPinchGesture::totalRotationAngle() const | - |
| 585 | { | - |
| 586 | return d_func()->totalRotationAngle; never executed: return d_func()->totalRotationAngle; | 0 |
| 587 | } | - |
| 588 | | - |
| 589 | qreal QPinchGesture::lastRotationAngle() const | - |
| 590 | { | - |
| 591 | return d_func()->lastRotationAngle; never executed: return d_func()->lastRotationAngle; | 0 |
| 592 | } | - |
| 593 | | - |
| 594 | qreal QPinchGesture::rotationAngle() const | - |
| 595 | { | - |
| 596 | return d_func()->rotationAngle; never executed: return d_func()->rotationAngle; | 0 |
| 597 | } | - |
| 598 | | - |
| 599 | void QPinchGesture::setTotalRotationAngle(qreal value) | - |
| 600 | { | - |
| 601 | d_func()->totalRotationAngle = value; never executed (the execution status of this line is deduced): d_func()->totalRotationAngle = value; | - |
| 602 | } | 0 |
| 603 | | - |
| 604 | void QPinchGesture::setLastRotationAngle(qreal value) | - |
| 605 | { | - |
| 606 | d_func()->lastRotationAngle = value; never executed (the execution status of this line is deduced): d_func()->lastRotationAngle = value; | - |
| 607 | } | 0 |
| 608 | | - |
| 609 | void QPinchGesture::setRotationAngle(qreal value) | - |
| 610 | { | - |
| 611 | d_func()->rotationAngle = value; never executed (the execution status of this line is deduced): d_func()->rotationAngle = value; | - |
| 612 | } | 0 |
| 613 | | - |
| 614 | /*! | - |
| 615 | \class QSwipeGesture | - |
| 616 | \since 4.6 | - |
| 617 | \brief The QSwipeGesture class describes a swipe gesture made by the user. | - |
| 618 | \ingroup gestures | - |
| 619 | \inmodule QtWidgets | - |
| 620 | | - |
| 621 | \image swipegesture.png | - |
| 622 | | - |
| 623 | For an overview of gesture handling in Qt and information on using gestures | - |
| 624 | in your applications, see the \l{Gestures in Widgets and Graphics View} document. | - |
| 625 | | - |
| 626 | \sa QPanGesture, QPinchGesture | - |
| 627 | */ | - |
| 628 | | - |
| 629 | /*! | - |
| 630 | \enum QSwipeGesture::SwipeDirection | - |
| 631 | | - |
| 632 | This enum describes the possible directions for the gesture's motion | - |
| 633 | along the horizontal and vertical axes. | - |
| 634 | | - |
| 635 | \value NoDirection The gesture had no motion associated with it on a particular axis. | - |
| 636 | \value Left The gesture involved a horizontal motion to the left. | - |
| 637 | \value Right The gesture involved a horizontal motion to the right. | - |
| 638 | \value Up The gesture involved an upward vertical motion. | - |
| 639 | \value Down The gesture involved a downward vertical motion. | - |
| 640 | */ | - |
| 641 | | - |
| 642 | /*! | - |
| 643 | \property QSwipeGesture::horizontalDirection | - |
| 644 | \brief the horizontal direction of the gesture | - |
| 645 | | - |
| 646 | If the gesture has a horizontal component, the horizontal direction | - |
| 647 | is either Left or Right; otherwise, it is NoDirection. | - |
| 648 | | - |
| 649 | \sa verticalDirection, swipeAngle | - |
| 650 | */ | - |
| 651 | | - |
| 652 | /*! | - |
| 653 | \property QSwipeGesture::verticalDirection | - |
| 654 | \brief the vertical direction of the gesture | - |
| 655 | | - |
| 656 | If the gesture has a vertical component, the vertical direction | - |
| 657 | is either Up or Down; otherwise, it is NoDirection. | - |
| 658 | | - |
| 659 | \sa horizontalDirection, swipeAngle | - |
| 660 | */ | - |
| 661 | | - |
| 662 | /*! | - |
| 663 | \property QSwipeGesture::swipeAngle | - |
| 664 | \brief the angle of the motion associated with the gesture | - |
| 665 | | - |
| 666 | If the gesture has either a horizontal or vertical component, the | - |
| 667 | swipe angle describes the angle between the direction of motion and the | - |
| 668 | x-axis as defined using the standard widget | - |
| 669 | \l{Coordinate System}{coordinate system}. | - |
| 670 | | - |
| 671 | \sa horizontalDirection, verticalDirection | - |
| 672 | */ | - |
| 673 | | - |
| 674 | /*! | - |
| 675 | \property QSwipeGesture::velocity | - |
| 676 | \since 4.7.1 | - |
| 677 | \internal | - |
| 678 | */ | - |
| 679 | | - |
| 680 | /*! | - |
| 681 | \internal | - |
| 682 | */ | - |
| 683 | QSwipeGesture::QSwipeGesture(QObject *parent) | - |
| 684 | : QGesture(*new QSwipeGesturePrivate, parent) | - |
| 685 | { | - |
| 686 | d_func()->gestureType = Qt::SwipeGesture; executed (the execution status of this line is deduced): d_func()->gestureType = Qt::SwipeGesture; | - |
| 687 | } executed: }Execution Count:56 | 56 |
| 688 | | - |
| 689 | /*! | - |
| 690 | Destructor. | - |
| 691 | */ | - |
| 692 | QSwipeGesture::~QSwipeGesture() | - |
| 693 | { | - |
| 694 | } | - |
| 695 | | - |
| 696 | QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const | - |
| 697 | { | - |
| 698 | Q_D(const QSwipeGesture); never executed (the execution status of this line is deduced): const QSwipeGesturePrivate * const d = d_func(); | - |
| 699 | if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270) never evaluated: d->swipeAngle < 0 never evaluated: d->swipeAngle == 90 never evaluated: d->swipeAngle == 270 | 0 |
| 700 | return QSwipeGesture::NoDirection; never executed: return QSwipeGesture::NoDirection; | 0 |
| 701 | else if (d->swipeAngle < 90 || d->swipeAngle > 270) never evaluated: d->swipeAngle < 90 never evaluated: d->swipeAngle > 270 | 0 |
| 702 | return QSwipeGesture::Right; never executed: return QSwipeGesture::Right; | 0 |
| 703 | else | - |
| 704 | return QSwipeGesture::Left; never executed: return QSwipeGesture::Left; | 0 |
| 705 | } | - |
| 706 | | - |
| 707 | QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const | - |
| 708 | { | - |
| 709 | Q_D(const QSwipeGesture); never executed (the execution status of this line is deduced): const QSwipeGesturePrivate * const d = d_func(); | - |
| 710 | if (d->swipeAngle <= 0 || d->swipeAngle == 180) never evaluated: d->swipeAngle <= 0 never evaluated: d->swipeAngle == 180 | 0 |
| 711 | return QSwipeGesture::NoDirection; never executed: return QSwipeGesture::NoDirection; | 0 |
| 712 | else if (d->swipeAngle < 180) never evaluated: d->swipeAngle < 180 | 0 |
| 713 | return QSwipeGesture::Up; never executed: return QSwipeGesture::Up; | 0 |
| 714 | else | - |
| 715 | return QSwipeGesture::Down; never executed: return QSwipeGesture::Down; | 0 |
| 716 | } | - |
| 717 | | - |
| 718 | qreal QSwipeGesture::swipeAngle() const | - |
| 719 | { | - |
| 720 | return d_func()->swipeAngle; never executed: return d_func()->swipeAngle; | 0 |
| 721 | } | - |
| 722 | | - |
| 723 | void QSwipeGesture::setSwipeAngle(qreal value) | - |
| 724 | { | - |
| 725 | d_func()->swipeAngle = value; never executed (the execution status of this line is deduced): d_func()->swipeAngle = value; | - |
| 726 | } | 0 |
| 727 | | - |
| 728 | /*! | - |
| 729 | \class QTapGesture | - |
| 730 | \since 4.6 | - |
| 731 | \brief The QTapGesture class describes a tap gesture made by the user. | - |
| 732 | \ingroup gestures | - |
| 733 | \inmodule QtWidgets | - |
| 734 | | - |
| 735 | For an overview of gesture handling in Qt and information on using gestures | - |
| 736 | in your applications, see the \l{Gestures in Widgets and Graphics View} document. | - |
| 737 | | - |
| 738 | \sa QPanGesture, QPinchGesture | - |
| 739 | */ | - |
| 740 | | - |
| 741 | /*! | - |
| 742 | \property QTapGesture::position | - |
| 743 | \brief the position of the tap | - |
| 744 | */ | - |
| 745 | | - |
| 746 | /*! | - |
| 747 | \internal | - |
| 748 | */ | - |
| 749 | QTapGesture::QTapGesture(QObject *parent) | - |
| 750 | : QGesture(*new QTapGesturePrivate, parent) | - |
| 751 | { | - |
| 752 | d_func()->gestureType = Qt::TapGesture; executed (the execution status of this line is deduced): d_func()->gestureType = Qt::TapGesture; | - |
| 753 | } executed: }Execution Count:57 | 57 |
| 754 | | - |
| 755 | /*! | - |
| 756 | Destructor. | - |
| 757 | */ | - |
| 758 | QTapGesture::~QTapGesture() | - |
| 759 | { | - |
| 760 | } | - |
| 761 | | - |
| 762 | QPointF QTapGesture::position() const | - |
| 763 | { | - |
| 764 | return d_func()->position; never executed: return d_func()->position; | 0 |
| 765 | } | - |
| 766 | | - |
| 767 | void QTapGesture::setPosition(const QPointF &value) | - |
| 768 | { | - |
| 769 | d_func()->position = value; never executed (the execution status of this line is deduced): d_func()->position = value; | - |
| 770 | } | 0 |
| 771 | /*! | - |
| 772 | \class QTapAndHoldGesture | - |
| 773 | \since 4.6 | - |
| 774 | \brief The QTapAndHoldGesture class describes a tap-and-hold (aka LongTap) | - |
| 775 | gesture made by the user. | - |
| 776 | \ingroup gestures | - |
| 777 | \inmodule QtWidgets | - |
| 778 | | - |
| 779 | For an overview of gesture handling in Qt and information on using gestures | - |
| 780 | in your applications, see the \l{Gestures in Widgets and Graphics View} document. | - |
| 781 | | - |
| 782 | \sa QPanGesture, QPinchGesture | - |
| 783 | */ | - |
| 784 | | - |
| 785 | /*! | - |
| 786 | \property QTapAndHoldGesture::position | - |
| 787 | \brief the position of the tap | - |
| 788 | */ | - |
| 789 | | - |
| 790 | /*! | - |
| 791 | \internal | - |
| 792 | */ | - |
| 793 | QTapAndHoldGesture::QTapAndHoldGesture(QObject *parent) | - |
| 794 | : QGesture(*new QTapAndHoldGesturePrivate, parent) | - |
| 795 | { | - |
| 796 | d_func()->gestureType = Qt::TapAndHoldGesture; executed (the execution status of this line is deduced): d_func()->gestureType = Qt::TapAndHoldGesture; | - |
| 797 | } executed: }Execution Count:56 | 56 |
| 798 | | - |
| 799 | /*! | - |
| 800 | Destructor. | - |
| 801 | */ | - |
| 802 | QTapAndHoldGesture::~QTapAndHoldGesture() | - |
| 803 | { | - |
| 804 | } | - |
| 805 | | - |
| 806 | QPointF QTapAndHoldGesture::position() const | - |
| 807 | { | - |
| 808 | return d_func()->position; never executed: return d_func()->position; | 0 |
| 809 | } | - |
| 810 | | - |
| 811 | void QTapAndHoldGesture::setPosition(const QPointF &value) | - |
| 812 | { | - |
| 813 | d_func()->position = value; never executed (the execution status of this line is deduced): d_func()->position = value; | - |
| 814 | } | 0 |
| 815 | | - |
| 816 | /*! | - |
| 817 | Set the timeout, in milliseconds, before the gesture triggers. | - |
| 818 | | - |
| 819 | The recognizer will detect a touch down and if \a msecs | - |
| 820 | later the touch is still down, it will trigger the QTapAndHoldGesture. | - |
| 821 | The default value is 700 milliseconds. | - |
| 822 | */ | - |
| 823 | // static | - |
| 824 | void QTapAndHoldGesture::setTimeout(int msecs) | - |
| 825 | { | - |
| 826 | QTapAndHoldGesturePrivate::Timeout = msecs; never executed (the execution status of this line is deduced): QTapAndHoldGesturePrivate::Timeout = msecs; | - |
| 827 | } | 0 |
| 828 | | - |
| 829 | /*! | - |
| 830 | Gets the timeout, in milliseconds, before the gesture triggers. | - |
| 831 | | - |
| 832 | The recognizer will detect a touch down and if timeout() | - |
| 833 | later the touch is still down, it will trigger the QTapAndHoldGesture. | - |
| 834 | The default value is 700 milliseconds. | - |
| 835 | */ | - |
| 836 | // static | - |
| 837 | int QTapAndHoldGesture::timeout() | - |
| 838 | { | - |
| 839 | return QTapAndHoldGesturePrivate::Timeout; never executed: return QTapAndHoldGesturePrivate::Timeout; | 0 |
| 840 | } | - |
| 841 | | - |
| 842 | int QTapAndHoldGesturePrivate::Timeout = 700; // in ms | - |
| 843 | | - |
| 844 | | - |
| 845 | /*! | - |
| 846 | \class QGestureEvent | - |
| 847 | \since 4.6 | - |
| 848 | \ingroup events | - |
| 849 | \ingroup gestures | - |
| 850 | \inmodule QtWidgets | - |
| 851 | | - |
| 852 | \brief The QGestureEvent class provides the description of triggered gestures. | - |
| 853 | | - |
| 854 | The QGestureEvent class contains a list of gestures, which can be obtained using the | - |
| 855 | gestures() function. | - |
| 856 | | - |
| 857 | The gestures are either active or canceled. A list of those that are currently being | - |
| 858 | executed can be obtained using the activeGestures() function. A list of those which | - |
| 859 | were previously active and have been canceled can be accessed using the | - |
| 860 | canceledGestures() function. A gesture might be canceled if the current window loses | - |
| 861 | focus, for example, or because of a timeout, or for other reasons. | - |
| 862 | | - |
| 863 | If the event handler does not accept the event by calling the generic | - |
| 864 | QEvent::accept() function, all individual QGesture object that were not | - |
| 865 | accepted and in the Qt::GestureStarted state will be propagated up the | - |
| 866 | parent widget chain until a widget accepts them individually, by calling | - |
| 867 | QGestureEvent::accept() for each of them, or an event filter consumes the | - |
| 868 | event. | - |
| 869 | | - |
| 870 | \section1 Further Reading | - |
| 871 | | - |
| 872 | For an overview of gesture handling in Qt and information on using gestures | - |
| 873 | in your applications, see the \l{Gestures in Widgets and Graphics View} document. | - |
| 874 | | - |
| 875 | \sa QGesture, QGestureRecognizer, | - |
| 876 | QWidget::grabGesture(), QGraphicsObject::grabGesture() | - |
| 877 | */ | - |
| 878 | | - |
| 879 | /*! | - |
| 880 | Creates new QGestureEvent containing a list of \a gestures. | - |
| 881 | */ | - |
| 882 | QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures) | - |
| 883 | : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(0) | - |
| 884 | | - |
| 885 | { | - |
| 886 | } executed: }Execution Count:795 | 795 |
| 887 | | - |
| 888 | /*! | - |
| 889 | Destroys QGestureEvent. | - |
| 890 | */ | - |
| 891 | QGestureEvent::~QGestureEvent() | - |
| 892 | { | - |
| 893 | } | - |
| 894 | | - |
| 895 | /*! | - |
| 896 | Returns all gestures that are delivered in the event. | - |
| 897 | */ | - |
| 898 | QList<QGesture *> QGestureEvent::gestures() const | - |
| 899 | { | - |
| 900 | return m_gestures; executed: return m_gestures;Execution Count:1218 | 1218 |
| 901 | } | - |
| 902 | | - |
| 903 | /*! | - |
| 904 | Returns a gesture object by \a type. | - |
| 905 | */ | - |
| 906 | QGesture *QGestureEvent::gesture(Qt::GestureType type) const | - |
| 907 | { | - |
| 908 | for (int i = 0; i < m_gestures.size(); ++i) evaluated: i < m_gestures.size()| yes Evaluation Count:464 | yes Evaluation Count:194 |
| 194-464 |
| 909 | if (m_gestures.at(i)->gestureType() == type) evaluated: m_gestures.at(i)->gestureType() == type| yes Evaluation Count:138 | yes Evaluation Count:326 |
| 138-326 |
| 910 | return m_gestures.at(i); executed: return m_gestures.at(i);Execution Count:138 | 138 |
| 911 | return 0; executed: return 0;Execution Count:194 | 194 |
| 912 | } | - |
| 913 | | - |
| 914 | /*! | - |
| 915 | Returns a list of active (not canceled) gestures. | - |
| 916 | */ | - |
| 917 | QList<QGesture *> QGestureEvent::activeGestures() const | - |
| 918 | { | - |
| 919 | QList<QGesture *> gestures; never executed (the execution status of this line is deduced): QList<QGesture *> gestures; | - |
| 920 | foreach (QGesture *gesture, m_gestures) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(m_gestures)> _container_(m_gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 921 | if (gesture->state() != Qt::GestureCanceled) never evaluated: gesture->state() != Qt::GestureCanceled | 0 |
| 922 | gestures.append(gesture); never executed: gestures.append(gesture); | 0 |
| 923 | } | 0 |
| 924 | return gestures; never executed: return gestures; | 0 |
| 925 | } | - |
| 926 | | - |
| 927 | /*! | - |
| 928 | Returns a list of canceled gestures. | - |
| 929 | */ | - |
| 930 | QList<QGesture *> QGestureEvent::canceledGestures() const | - |
| 931 | { | - |
| 932 | QList<QGesture *> gestures; never executed (the execution status of this line is deduced): QList<QGesture *> gestures; | - |
| 933 | foreach (QGesture *gesture, m_gestures) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(m_gestures)> _container_(m_gestures); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGesture *gesture = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 934 | if (gesture->state() == Qt::GestureCanceled) never evaluated: gesture->state() == Qt::GestureCanceled | 0 |
| 935 | gestures.append(gesture); never executed: gestures.append(gesture); | 0 |
| 936 | } | 0 |
| 937 | return gestures; never executed: return gestures; | 0 |
| 938 | } | - |
| 939 | | - |
| 940 | /*! | - |
| 941 | Sets the accept flag of the given \a gesture object to the specified \a value. | - |
| 942 | | - |
| 943 | Setting the accept flag indicates that the event receiver wants the \a gesture. | - |
| 944 | Unwanted gestures may be propagated to the parent widget. | - |
| 945 | | - |
| 946 | By default, gestures in events of type QEvent::Gesture are accepted, and | - |
| 947 | gestures in QEvent::GestureOverride events are ignored. | - |
| 948 | | - |
| 949 | For convenience, the accept flag can also be set with | - |
| 950 | \l{QGestureEvent::accept()}{accept(gesture)}, and cleared with | - |
| 951 | \l{QGestureEvent::ignore()}{ignore(gesture)}. | - |
| 952 | */ | - |
| 953 | void QGestureEvent::setAccepted(QGesture *gesture, bool value) | - |
| 954 | { | - |
| 955 | if (gesture) partially evaluated: gesture| yes Evaluation Count:352 | no Evaluation Count:0 |
| 0-352 |
| 956 | setAccepted(gesture->gestureType(), value); executed: setAccepted(gesture->gestureType(), value);Execution Count:352 | 352 |
| 957 | } executed: }Execution Count:352 | 352 |
| 958 | | - |
| 959 | /*! | - |
| 960 | Sets the accept flag of the given \a gesture object, the equivalent of calling | - |
| 961 | \l{QGestureEvent::setAccepted()}{setAccepted(gesture, true)}. | - |
| 962 | | - |
| 963 | Setting the accept flag indicates that the event receiver wants the | - |
| 964 | gesture. Unwanted gestures may be propagated to the parent widget. | - |
| 965 | | - |
| 966 | \sa QGestureEvent::ignore() | - |
| 967 | */ | - |
| 968 | void QGestureEvent::accept(QGesture *gesture) | - |
| 969 | { | - |
| 970 | if (gesture) | 0 |
| 971 | setAccepted(gesture->gestureType(), true); never executed: setAccepted(gesture->gestureType(), true); | 0 |
| 972 | } | 0 |
| 973 | | - |
| 974 | /*! | - |
| 975 | Clears the accept flag parameter of the given \a gesture object, the equivalent | - |
| 976 | of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}. | - |
| 977 | | - |
| 978 | Clearing the accept flag indicates that the event receiver does not | - |
| 979 | want the gesture. Unwanted gestures may be propagated to the parent widget. | - |
| 980 | | - |
| 981 | \sa QGestureEvent::accept() | - |
| 982 | */ | - |
| 983 | void QGestureEvent::ignore(QGesture *gesture) | - |
| 984 | { | - |
| 985 | if (gesture) evaluated: gesture| yes Evaluation Count:150 | yes Evaluation Count:192 |
| 150-192 |
| 986 | setAccepted(gesture->gestureType(), false); executed: setAccepted(gesture->gestureType(), false);Execution Count:150 | 150 |
| 987 | } executed: }Execution Count:342 | 342 |
| 988 | | - |
| 989 | /*! | - |
| 990 | Returns true if the \a gesture is accepted; otherwise returns false. | - |
| 991 | */ | - |
| 992 | bool QGestureEvent::isAccepted(QGesture *gesture) const | - |
| 993 | { | - |
| 994 | return gesture ? isAccepted(gesture->gestureType()) : false; executed: return gesture ? isAccepted(gesture->gestureType()) : false;Execution Count:320 | 320 |
| 995 | } | - |
| 996 | | - |
| 997 | /*! | - |
| 998 | Sets the accept flag of the given \a gestureType object to the specified | - |
| 999 | \a value. | - |
| 1000 | | - |
| 1001 | Setting the accept flag indicates that the event receiver wants to receive | - |
| 1002 | gestures of the specified type, \a gestureType. Unwanted gestures may be | - |
| 1003 | propagated to the parent widget. | - |
| 1004 | | - |
| 1005 | By default, gestures in events of type QEvent::Gesture are accepted, and | - |
| 1006 | gestures in QEvent::GestureOverride events are ignored. | - |
| 1007 | | - |
| 1008 | For convenience, the accept flag can also be set with | - |
| 1009 | \l{QGestureEvent::accept()}{accept(gestureType)}, and cleared with | - |
| 1010 | \l{QGestureEvent::ignore()}{ignore(gestureType)}. | - |
| 1011 | */ | - |
| 1012 | void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value) | - |
| 1013 | { | - |
| 1014 | setAccepted(false); executed (the execution status of this line is deduced): setAccepted(false); | - |
| 1015 | m_accepted[gestureType] = value; executed (the execution status of this line is deduced): m_accepted[gestureType] = value; | - |
| 1016 | } executed: }Execution Count:502 | 502 |
| 1017 | | - |
| 1018 | /*! | - |
| 1019 | Sets the accept flag of the given \a gestureType, the equivalent of calling | - |
| 1020 | \l{QGestureEvent::setAccepted()}{setAccepted(gestureType, true)}. | - |
| 1021 | | - |
| 1022 | Setting the accept flag indicates that the event receiver wants the | - |
| 1023 | gesture. Unwanted gestures may be propagated to the parent widget. | - |
| 1024 | | - |
| 1025 | \sa QGestureEvent::ignore() | - |
| 1026 | */ | - |
| 1027 | void QGestureEvent::accept(Qt::GestureType gestureType) | - |
| 1028 | { | - |
| 1029 | setAccepted(gestureType, true); never executed (the execution status of this line is deduced): setAccepted(gestureType, true); | - |
| 1030 | } | 0 |
| 1031 | | - |
| 1032 | /*! | - |
| 1033 | Clears the accept flag parameter of the given \a gestureType, the equivalent | - |
| 1034 | of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}. | - |
| 1035 | | - |
| 1036 | Clearing the accept flag indicates that the event receiver does not | - |
| 1037 | want the gesture. Unwanted gestures may be propgated to the parent widget. | - |
| 1038 | | - |
| 1039 | \sa QGestureEvent::accept() | - |
| 1040 | */ | - |
| 1041 | void QGestureEvent::ignore(Qt::GestureType gestureType) | - |
| 1042 | { | - |
| 1043 | setAccepted(gestureType, false); never executed (the execution status of this line is deduced): setAccepted(gestureType, false); | - |
| 1044 | } | 0 |
| 1045 | | - |
| 1046 | /*! | - |
| 1047 | Returns true if the gesture of type \a gestureType is accepted; otherwise | - |
| 1048 | returns false. | - |
| 1049 | */ | - |
| 1050 | bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const | - |
| 1051 | { | - |
| 1052 | return m_accepted.value(gestureType, true); executed: return m_accepted.value(gestureType, true);Execution Count:320 | 320 |
| 1053 | } | - |
| 1054 | | - |
| 1055 | /*! | - |
| 1056 | \internal | - |
| 1057 | | - |
| 1058 | Sets the widget for this event to the \a widget specified. | - |
| 1059 | */ | - |
| 1060 | void QGestureEvent::setWidget(QWidget *widget) | - |
| 1061 | { | - |
| 1062 | m_widget = widget; executed (the execution status of this line is deduced): m_widget = widget; | - |
| 1063 | } executed: }Execution Count:350 | 350 |
| 1064 | | - |
| 1065 | /*! | - |
| 1066 | Returns the widget on which the event occurred. | - |
| 1067 | */ | - |
| 1068 | QWidget *QGestureEvent::widget() const | - |
| 1069 | { | - |
| 1070 | return m_widget; executed: return m_widget;Execution Count:351 | 351 |
| 1071 | } | - |
| 1072 | | - |
| 1073 | #ifndef QT_NO_GRAPHICSVIEW | - |
| 1074 | /*! | - |
| 1075 | Returns the scene-local coordinates if the \a gesturePoint is inside a | - |
| 1076 | graphics view. | - |
| 1077 | | - |
| 1078 | This functional might be useful when the gesture event is delivered to a | - |
| 1079 | QGraphicsObject to translate a point in screen coordinates to scene-local | - |
| 1080 | coordinates. | - |
| 1081 | | - |
| 1082 | \sa QPointF::isNull() | - |
| 1083 | */ | - |
| 1084 | QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const | - |
| 1085 | { | - |
| 1086 | QWidget *w = widget(); executed (the execution status of this line is deduced): QWidget *w = widget(); | - |
| 1087 | if (w) // we get the viewport as widget, not the graphics view evaluated: w| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 1088 | w = w->parentWidget(); executed: w = w->parentWidget();Execution Count:1 | 1 |
| 1089 | QGraphicsView *view = qobject_cast<QGraphicsView*>(w); executed (the execution status of this line is deduced): QGraphicsView *view = qobject_cast<QGraphicsView*>(w); | - |
| 1090 | if (view) { evaluated: view| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 1091 | return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint())); executed: return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint()));Execution Count:1 | 1 |
| 1092 | } | - |
| 1093 | return QPointF(); executed: return QPointF();Execution Count:1 | 1 |
| 1094 | } | - |
| 1095 | #endif //QT_NO_GRAPHICSVIEW | - |
| 1096 | | - |
| 1097 | #ifdef Q_NO_USING_KEYWORD | - |
| 1098 | /*! | - |
| 1099 | \fn void QGestureEvent::setAccepted(bool accepted) | - |
| 1100 | | - |
| 1101 | Sets or clears the event's internal flag that determines whether it should | - |
| 1102 | be delivered to other objects. | - |
| 1103 | | - |
| 1104 | Calling this function with a value of true for \a accepted indicates that the | - |
| 1105 | caller has accepted the event and that it should not be propagated further. | - |
| 1106 | Calling this function with a value of false indicates that the caller has | - |
| 1107 | ignored the event and that it should be delivered to other objects. | - |
| 1108 | | - |
| 1109 | For convenience, the accept flag can also be set with accept(), and cleared | - |
| 1110 | with ignore(). | - |
| 1111 | | - |
| 1112 | \sa QEvent::accepted | - |
| 1113 | */ | - |
| 1114 | /*! | - |
| 1115 | \fn bool QGestureEvent::isAccepted() const | - |
| 1116 | | - |
| 1117 | Returns true is the event has been accepted; otherwise returns false. | - |
| 1118 | | - |
| 1119 | \sa QEvent::accepted | - |
| 1120 | */ | - |
| 1121 | /*! | - |
| 1122 | \fn void QGestureEvent::accept() | - |
| 1123 | | - |
| 1124 | Accepts the event, the equivalent of calling setAccepted(true). | - |
| 1125 | | - |
| 1126 | \sa QEvent::accept() | - |
| 1127 | */ | - |
| 1128 | /*! | - |
| 1129 | \fn void QGestureEvent::ignore() | - |
| 1130 | | - |
| 1131 | Ignores the event, the equivalent of calling setAccepted(false). | - |
| 1132 | | - |
| 1133 | \sa QEvent::ignore() | - |
| 1134 | */ | - |
| 1135 | #endif | - |
| 1136 | | - |
| 1137 | QT_END_NAMESPACE | - |
| 1138 | | - |
| 1139 | #include <moc_qgesture.cpp> | - |
| 1140 | | - |
| 1141 | #endif // QT_NO_GESTURES | - |
| 1142 | | - |
| | |