Qt 4.8
Public Functions | List of all members
QMacSwipeGestureRecognizer Class Reference

#include <qmacgesturerecognizer_mac_p.h>

Inheritance diagram for QMacSwipeGestureRecognizer:
QGestureRecognizer

Public Functions

QGesturecreate (QObject *target)
 This function is called by Qt to create a new QGesture object for the given target (QWidget or QGraphicsObject). More...
 
 QMacSwipeGestureRecognizer ()
 
QGestureRecognizer::Result recognize (QGesture *gesture, QObject *watched, QEvent *event)
 Handles the given event for the watched object, updating the state of the gesture object as required, and returns a suitable result for the current recognition step. More...
 
void reset (QGesture *gesture)
 This function is called by the framework to reset a given gesture. More...
 
- Public Functions inherited from QGestureRecognizer
 QGestureRecognizer ()
 Constructs a new gesture recognizer object. More...
 
virtual ~QGestureRecognizer ()
 Destroys the gesture recognizer. More...
 

Additional Inherited Members

- Public Types inherited from QGestureRecognizer
enum  ResultFlag {
  Ignore = 0x0001, MayBeGesture = 0x0002, TriggerGesture = 0x0004, FinishGesture = 0x0008,
  CancelGesture = 0x0010, ResultState_Mask = 0x00ff, ConsumeEventHint = 0x0100, ResultHint_Mask = 0xff00
}
 This enum describes the result of the current event filtering step in a gesture recognizer state machine. More...
 
- Static Public Functions inherited from QGestureRecognizer
static Qt::GestureType registerRecognizer (QGestureRecognizer *recognizer)
 Registers the given recognizer in the gesture framework and returns a gesture ID for it. More...
 
static void unregisterRecognizer (Qt::GestureType type)
 Unregisters all gesture recognizers of the specified type. More...
 

Detailed Description

Definition at line 64 of file qmacgesturerecognizer_mac_p.h.

Constructors and Destructors

◆ QMacSwipeGestureRecognizer()

QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer ( )

Definition at line 54 of file qmacgesturerecognizer_mac.mm.

55 {
56 }

Functions

◆ create()

QGesture * QMacSwipeGestureRecognizer::create ( QObject target)
virtual

This function is called by Qt to create a new QGesture object for the given target (QWidget or QGraphicsObject).

Reimplement this function to create a custom QGesture-derived gesture object if necessary.

The application takes ownership of the created gesture object.

Reimplemented from QGestureRecognizer.

Definition at line 58 of file qmacgesturerecognizer_mac.mm.

59 {
60  return new QSwipeGesture;
61 }
The QSwipeGesture class describes a swipe gesture made by the user.
Definition: qgesture.h:207

◆ recognize()

QGestureRecognizer::Result QMacSwipeGestureRecognizer::recognize ( QGesture gesture,
QObject watched,
QEvent event 
)
virtual

Handles the given event for the watched object, updating the state of the gesture object as required, and returns a suitable result for the current recognition step.

This function is called by the framework to allow the recognizer to filter input events dispatched to QWidget or QGraphicsObject instances that it is monitoring.

The result reflects how much of the gesture has been recognized. The state of the gesture object is set depending on the result.

See also
QGestureRecognizer::Result

Implements QGestureRecognizer.

Definition at line 64 of file qmacgesturerecognizer_mac.mm.

65 {
66  if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) {
67  QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
68  switch (ev->gestureType) {
70  QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
71  g->setSwipeAngle(ev->angle);
72  g->setHotSpot(ev->position);
74  break; }
75  default:
76  break;
77  }
78  }
79 
81 }
EventRef event
void setHotSpot(const QPointF &value)
Definition: qgesture.cpp:180
void setSwipeAngle(qreal value)
Definition: qgesture.cpp:794
The QSwipeGesture class describes a swipe gesture made by the user.
Definition: qgesture.h:207
Type type() const
Returns the event type.
Definition: qcoreevent.h:303

◆ reset()

void QMacSwipeGestureRecognizer::reset ( QGesture gesture)
virtual

This function is called by the framework to reset a given gesture.

Reimplement this function to implement additional requirements for custom QGesture objects. This may be necessary if you implement a custom QGesture whose properties need special handling when the gesture is reset.

Reimplemented from QGestureRecognizer.

Definition at line 83 of file qmacgesturerecognizer_mac.mm.

Referenced by QMacPinchGestureRecognizer::recognize(), and QMacPinchGestureRecognizer::reset().

84 {
85  QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
86  g->setSwipeAngle(0);
88 }
virtual void reset(QGesture *state)
This function is called by the framework to reset a given gesture.
void setSwipeAngle(qreal value)
Definition: qgesture.cpp:794
The QSwipeGesture class describes a swipe gesture made by the user.
Definition: qgesture.h:207

The documentation for this class was generated from the following files: