summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-10-22 20:39:24 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-10-26 10:42:28 (GMT)
commitf3cbbd7b8388b4c7445a5fa56d59abdae6c532cb (patch)
tree7ba56743b6a00eed6f6c8787c71371ec242b53b0 /src
parentdc54674e9f8998b4aee3a58d06f6b5533ccd3cfe (diff)
downloadQt-f3cbbd7b8388b4c7445a5fa56d59abdae6c532cb.zip
Qt-f3cbbd7b8388b4c7445a5fa56d59abdae6c532cb.tar.gz
Qt-f3cbbd7b8388b4c7445a5fa56d59abdae6c532cb.tar.bz2
Added convenience functions QGestureEvent::setAccepted with a gesture
type argument. Reviewed-by: Thomas Zander
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qevent.cpp68
-rw-r--r--src/gui/kernel/qevent.h5
2 files changed, 68 insertions, 5 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 74dfa53..ea05869 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -4298,9 +4298,8 @@ QList<QGesture *> QGestureEvent::canceledGestures() const
*/
void QGestureEvent::setAccepted(QGesture *gesture, bool value)
{
- setAccepted(false);
if (gesture)
- d_func()->accepted[gesture->gestureType()] = value;
+ setAccepted(gesture->gestureType(), value);
}
/*!
@@ -4314,7 +4313,8 @@ void QGestureEvent::setAccepted(QGesture *gesture, bool value)
*/
void QGestureEvent::accept(QGesture *gesture)
{
- setAccepted(gesture, true);
+ if (gesture)
+ setAccepted(gesture->gestureType(), true);
}
/*!
@@ -4328,7 +4328,8 @@ void QGestureEvent::accept(QGesture *gesture)
*/
void QGestureEvent::ignore(QGesture *gesture)
{
- setAccepted(gesture, false);
+ if (gesture)
+ setAccepted(gesture->gestureType(), false);
}
/*!
@@ -4336,7 +4337,64 @@ void QGestureEvent::ignore(QGesture *gesture)
*/
bool QGestureEvent::isAccepted(QGesture *gesture) const
{
- return gesture ? d_func()->accepted.value(gesture->gestureType(), true) : false;
+ return gesture ? isAccepted(gesture->gestureType()) : false;
+}
+
+/*!
+ Sets the accept flag of the given \a gestureType 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(gestureType)}, and cleared with
+ \l{QGestureEvent::ignore()}{ignore(gestureType)}.
+*/
+void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value)
+{
+ setAccepted(false);
+ d_func()->accepted[gestureType] = value;
+}
+
+/*!
+ Sets the accept flag of the given \a gestureType, the equivalent of calling
+ \l{QGestureEvent::setAccepted()}{setAccepted(gestureType, 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(Qt::GestureType gestureType)
+{
+ setAccepted(gestureType, true);
+}
+
+/*!
+ Clears the accept flag parameter of the given \a gestureType, 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(Qt::GestureType gestureType)
+{
+ setAccepted(gestureType, false);
+}
+
+/*!
+ Returns true if the gesture of type \a gestureType is accepted; otherwise
+ returns false.
+*/
+bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const
+{
+ return d_func()->accepted.value(gestureType, true);
}
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index b7370fd..fb245c0 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -851,6 +851,11 @@ public:
void ignore(QGesture *);
bool isAccepted(QGesture *) const;
+ void setAccepted(Qt::GestureType, bool);
+ void accept(Qt::GestureType);
+ void ignore(Qt::GestureType);
+ bool isAccepted(Qt::GestureType) const;
+
void setWidget(QWidget *widget);
QWidget *widget() const;