diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-16 13:56:24 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-05-11 14:51:34 (GMT) |
commit | d392c3073c10d053ffcd5d64d4f9d89a971fcb2d (patch) | |
tree | b0bc9f3b46a3b76051d45b72e984c177f17bb66d /src/gui/kernel/qgesturerecognizer.cpp | |
parent | d8e4d20f3d225a3c29168d7a9440f2efc129ea8e (diff) | |
download | Qt-d392c3073c10d053ffcd5d64d4f9d89a971fcb2d.zip Qt-d392c3073c10d053ffcd5d64d4f9d89a971fcb2d.tar.gz Qt-d392c3073c10d053ffcd5d64d4f9d89a971fcb2d.tar.bz2 |
Extended the gesture documentation.
Also made some small fixes that noticed while was writing a doc.
Diffstat (limited to 'src/gui/kernel/qgesturerecognizer.cpp')
-rw-r--r-- | src/gui/kernel/qgesturerecognizer.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 9a00138..7791ad7 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -49,17 +49,96 @@ QT_BEGIN_NAMESPACE QString qt_getStandardGestureTypeName(Qt::GestureType gestureType); +/*! + \class QGestureRecognizer + + \brief The QGestureRecognizer class is the base class for + implementing custom gestures. + + This is a base class, to create a custom gesture type, you should + subclass it and implement its pure virtual functions. + + Usually gesture recognizer implements state machine, storing its + state internally in the recognizer object. The recognizer receives + input events through the \l{QGestureRecognizer::}{filterEvent()} + virtual function and decides whether the parsed event should + change the state of the recognizer - i.e. if the event starts or + ends a gesture or if it isn't related to gesture at all. +*/ + +/*! + \enum QGestureRecognizer::Result + + This enum type defines the state of the gesture recognizer. + + \value NotGesture Not a gesture. + + \value GestureStarted The long-term gesture has started. When the + recognizer is in started state, a gesture event containing + QGesture objects returned by the + \l{QGestureRecognizer::}{getGesture()} will be sent to a widget. + + \value GestureFinished A gesture has ended. The gesture event will + be sent to a widget. + + \value MaybeGesture Gesture hasn't started yet, but it might start + soon after next events are received by the recognizer. That means + that gesture manager shouldn't reset() the internal state of the + gesture recognizer. +*/ + +/*! \fn QGestureRecognizer::Result QGestureRecognizer::filterEvent(const QEvent *event) + + This is a pure virtual function that needs to be implemented in + subclasses. + + Parses input \a event and returns the result, which specifies if + the event sequence is a gesture or not. +*/ + +/*! \fn QGesture* QGestureRecognizer::getGesture() + + Returns a gesture object that will be send to the widget. This + function is called when the gesture recognizer changed its state + to QGestureRecognizer::GestureStarted or + QGestureRecognizer::GestureFinished. + + The gesture object is owned by the recognizer itself. +*/ + +/*! \fn void QGestureRecognizer::reset() + + Resets the internal state of the gesture recognizer. +*/ + +/*! \fn void QGestureRecognizer::stateChanged(QGestureRecognizer::Result result) + + The gesture recognizer might emit the stateChanged() signal when + the gesture state changes asynchronously, i.e. without any event + being filtered through filterEvent(). +*/ + QGestureRecognizerPrivate::QGestureRecognizerPrivate() : gestureType(Qt::UnknownGesture) { } +/*! + Creates a new gesture recognizer object that handles gestures of + the specific \a type. + + \sa QApplication::addGestureRecognizer(), + QApplication::removeGestureRecognizer(), +*/ QGestureRecognizer::QGestureRecognizer(const QString &type) : QObject(*new QGestureRecognizerPrivate, 0) { d_func()->customGestureType = type; } +/*! + Returns the name of the gesture that is handled by the recognizer. +*/ QString QGestureRecognizer::gestureType() const { Q_D(const QGestureRecognizer); |