summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r--src/gui/kernel/qevent.cpp80
1 files changed, 68 insertions, 12 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 4316714..4826704 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -4196,31 +4196,47 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
\since 4.6
\ingroup events
- \brief The QGestureEvent class provides the description of triggered
- gestures.
+ \brief The QGestureEvent class provides the description of triggered gestures.
- The QGestureEvent class contains a list of gestures that are being executed
- right now (\l{QGestureEvent::}{activeGestures()}) and a list of gestures
- that are \l{QGestureEvent::canceledGestures}{cancelled} (a gesture might be
- cancelled because the window lost focus, or because of timeout, etc).
+ The QGestureEvent class contains a list of gestures, which can be obtained using the
+ allGestures() function.
- \sa QGesture
+ The gestures are either active or canceled. A list of those that are currently being
+ executed can be obtained using the activeGestures() function. A list of those which
+ were previously active and have been canceled can be accessed using the
+ canceledGestures() function. A gesture might be canceled if the current window loses
+ focus, for example, or because of a timeout, or for other reasons.
+
+ If the event handler does not accept the event by calling the generic
+ QEvent::accept() function, all individual QGesture object that were not accepted
+ will be propagated up the parent widget chain until a widget accepts them
+ individually, by calling QGestureEvent::accept() for each of them, or an event
+ filter consumes the event.
+
+ \sa QGesture, QGestureRecognizer,
+ QWidget::grabGesture(), QGraphicsObject::grabGesture()
*/
/*!
Creates new QGestureEvent containing a list of \a gestures.
*/
-QGestureEvent::QGestureEvent(const QList<QGesture*> &gestures)
+QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)
: QEvent(QEvent::Gesture), gestures_(gestures)
{
}
-QList<QGesture*> QGestureEvent::allGestures() const
+/*!
+ Returns all gestures that are delivered in the event.
+*/
+QList<QGesture *> QGestureEvent::allGestures() const
{
return gestures_;
}
-QGesture* QGestureEvent::gesture(Qt::GestureType type)
+/*!
+ Returns a gesture object by \a type.
+*/
+QGesture *QGestureEvent::gesture(Qt::GestureType type) const
{
for(int i = 0; i < gestures_.size(); ++i)
if (gestures_.at(i)->gestureType() == type)
@@ -4228,16 +4244,35 @@ QGesture* QGestureEvent::gesture(Qt::GestureType type)
return 0;
}
-QList<QGesture*> QGestureEvent::activeGestures() const
+/*!
+ Returns a list of active (not canceled) gestures.
+*/
+QList<QGesture *> QGestureEvent::activeGestures() const
{
return gestures_;
}
-QList<QGesture*> QGestureEvent::canceledGestures() const
+/*!
+ Returns a list of canceled gestures.
+*/
+QList<QGesture *> QGestureEvent::canceledGestures() const
{
return gestures_;
}
+/*!
+ Sets the accept flag of the given \a gesture object to the specified \a value.
+
+ Setting the accept flag indicates that the event receiver wants the \a gesture.
+ Unwanted gestures may be propagated to the parent widget.
+
+ By default, gestures in events of type QEvent::Gesture are accepted, and
+ gestures in QEvent::GestureOverride events are ignored.
+
+ For convenience, the accept flag can also be set with
+ \l{QGestureEvent::accept()}{accept(gesture)}, and cleared with
+ \l{QGestureEvent::ignore()}{ignore(gesture)}.
+*/
void QGestureEvent::setAccepted(QGesture *gesture, bool value)
{
setAccepted(false);
@@ -4245,16 +4280,37 @@ void QGestureEvent::setAccepted(QGesture *gesture, bool value)
gesture->d_func()->accept = value;
}
+/*!
+ Sets the accept flag of the given \a gesture object, the equivalent of calling
+ \l{QGestureEvent::setAccepted()}{setAccepted(gesture, true)}.
+
+ Setting the accept flag indicates that the event receiver wants the
+ gesture. Unwanted gestures may be propagated to the parent widget.
+
+ \sa QGestureEvent::ignore()
+*/
void QGestureEvent::accept(QGesture *gesture)
{
setAccepted(gesture, true);
}
+/*!
+ Clears the accept flag parameter of the given \a gesture object, the equivalent
+ of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}.
+
+ Clearing the accept flag indicates that the event receiver does not
+ want the gesture. Unwanted gestures may be propgated to the parent widget.
+
+ \sa QGestureEvent::accept()
+*/
void QGestureEvent::ignore(QGesture *gesture)
{
setAccepted(gesture, false);
}
+/*!
+ Returns true if the \a gesture is accepted; otherwise returns false.
+*/
bool QGestureEvent::isAccepted(QGesture *gesture) const
{
return gesture ? gesture->d_func()->accept : false;