summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-02 13:13:17 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-03 10:26:02 (GMT)
commitb112af4614dffcb230956bfa319c37fc00e6a13c (patch)
tree04b393fc63d0fd259e25b7fccdb94a7871bc45e6 /src
parent29ddc44a11e16347212fccd3d81c4e0c91bf61a1 (diff)
downloadQt-b112af4614dffcb230956bfa319c37fc00e6a13c.zip
Qt-b112af4614dffcb230956bfa319c37fc00e6a13c.tar.gz
Qt-b112af4614dffcb230956bfa319c37fc00e6a13c.tar.bz2
Added QGraphicsObject::ungrabGesture()
Oops, apparently we forgot to add a function for unsubscribing a graphics object from a gesture. Fixing it now. Reviewed-by: trustme
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp17
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h1
-rw-r--r--src/gui/kernel/qwidget.cpp4
3 files changed, 18 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 738c6e3..58d7e7d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7322,9 +7322,8 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
/*!
Subscribes the graphics object to the given \a gesture for the specified \a context.
- \sa QGestureEvent
+ \sa ungrabGesture(), QGestureEvent
*/
-
void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext context)
{
QGraphicsItemPrivate * const d = QGraphicsItem::d_func();
@@ -7333,6 +7332,20 @@ void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext co
}
/*!
+ Unsubscribes the graphics object from the given \a gesture.
+
+ \sa grabGesture(), QGestureEvent
+*/
+void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)
+{
+ QGraphicsItemPrivate * const d = QGraphicsItem::d_func();
+ if (d->gestureContext.remove(gesture)) {
+ QGestureManager *manager = QGestureManager::instance();
+ manager->cleanupCachedGestures(this, gesture);
+ }
+}
+
+/*!
\property QGraphicsObject::parent
\brief the parent of the item
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index f3fe99c..fc180f3 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -556,6 +556,7 @@ public:
#endif
void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture);
+ void ungrabGesture(Qt::GestureType type);
Q_SIGNALS:
void parentChanged();
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 14f3bfe..ac2808c 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11712,7 +11712,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const
/*!
Subscribes the widget to a given \a gesture with a \a context.
- \sa QGestureEvent
+ \sa ungrabGesture(), QGestureEvent
\since 4.6
*/
void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context)
@@ -11725,7 +11725,7 @@ void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context)
/*!
Unsubscribes the widget to a given \a gesture type
- \sa QGestureEvent
+ \sa grabGesture(), QGestureEvent
\since 4.6
*/
void QWidget::ungrabGesture(Qt::GestureType gesture)