Simplify MultiPointTouchArea signal names.
authorMichael Brasser <michael.brasser@nokia.com>
Fri, 30 Dec 2011 06:39:17 +0000 (16:39 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 3 Jan 2012 00:27:55 +0000 (01:27 +0100)
Change-Id: I0617bf7138b76495c111739e2cbdf3b77c4b6a5d
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
src/quick/items/qquickmultipointtoucharea.cpp
src/quick/items/qquickmultipointtoucharea_p.h
tests/auto/qtquick2/qquickmultipointtoucharea/data/inFlickable.qml
tests/auto/qtquick2/qquickmultipointtoucharea/data/signalTest.qml

index 8f27f04..d590d60 100644 (file)
@@ -229,43 +229,43 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
 */
 
 /*!
-    \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsPressed(list<TouchPoint> touchPoints)
+    \qmlsignal QtQuick2::MultiPointTouchArea::onPressed(list<TouchPoint> touchPoints)
 
     This handler is called when new touch points are added. \a touchPoints is a list of these new points.
 
     If minimumTouchPoints is set to a value greater than one, this handler will not be called until the minimum number
-    of required touch points has been reached. At that point, touchPointsPressed will be called with all the current touch points.
+    of required touch points has been reached. At that point, onPressed will be called with all the current touch points.
 */
 
 /*!
-    \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsUpdated(list<TouchPoint> touchPoints)
+    \qmlsignal QtQuick2::MultiPointTouchArea::onUpdated(list<TouchPoint> touchPoints)
 
     This handler is called when existing touch points are updated. \a touchPoints is a list of these updated points.
 */
 
 /*!
-    \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsReleased(list<TouchPoint> touchPoints)
+    \qmlsignal QtQuick2::MultiPointTouchArea::onReleased(list<TouchPoint> touchPoints)
 
     This handler is called when existing touch points are removed. \a touchPoints is a list of these removed points.
 */
 
 /*!
-    \qmlsignal QtQuick2::MultiPointTouchArea::touchPointsCanceled(list<TouchPoint> touchPoints)
+    \qmlsignal QtQuick2::MultiPointTouchArea::onCanceled(list<TouchPoint> touchPoints)
 
     This handler is called when new touch events have been canceled because another element stole the touch event handling.
 
     This signal is for advanced use: it is useful when there is more than one MultiPointTouchArea
     that is handling input, or when there is a MultiPointTouchArea inside a \l Flickable. In the latter
-    case, if you execute some logic on the touchPointsPressed signal and then start dragging, the
+    case, if you execute some logic on the onPressed signal and then start dragging, the
     \l Flickable may steal the touch handling from the MultiPointTouchArea. In these cases, to reset
     the logic when the MultiPointTouchArea has lost the touch handling to the \l Flickable,
-    \c onTouchPointsCanceled should be used in addition to onTouchPointsReleased.
+    \c onCanceled should be used in addition to onReleased.
 
     \a touchPoints is the list of canceled points.
 */
 
 /*!
-    \qmlsignal QtQuick2::MultiPointTouchArea::gestureStarted(GestureEvent gesture)
+    \qmlsignal QtQuick2::MultiPointTouchArea::onGestureStarted(GestureEvent gesture)
 
     This handler is called when the global drag threshold has been reached.
 
@@ -278,7 +278,7 @@ void QQuickTouchPoint::setSceneY(qreal sceneY)
 */
 
 /*!
-    \qmlsignal QtQuick2::MultiPointTouchArea::touchUpdated(list<TouchPoint> touchPoints)
+    \qmlsignal QtQuick2::MultiPointTouchArea::onTouchUpdated(list<TouchPoint> touchPoints)
 
     This handler is called when the touch points handled by the MultiPointTouchArea change. This includes adding new touch points,
     removing or canceling previous touch points, as well as updating current touch point data. \a touchPoints is the list of all current touch
@@ -477,9 +477,18 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
             }
         }
 
-        if (ended) emit touchPointsReleased(_releasedTouchPoints);
-        if (moved) emit touchPointsUpdated(_movedTouchPoints);
-        if (started) emit touchPointsPressed(_pressedTouchPoints);
+        if (ended) {
+            emit released(_releasedTouchPoints);
+            emit touchPointsReleased(_releasedTouchPoints);
+        }
+        if (moved) {
+            emit updated(_movedTouchPoints);
+            emit touchPointsUpdated(_movedTouchPoints);
+        }
+        if (started) {
+            emit pressed(_pressedTouchPoints);
+            emit touchPointsPressed(_pressedTouchPoints);
+        }
         if (ended || moved || started) emit touchUpdated(_touchPoints.values());
     }
 }
@@ -587,6 +596,7 @@ void QQuickMultiPointTouchArea::ungrab()
         setKeepTouchGrab(false);
         foreach (QObject *obj, _touchPoints)
             static_cast<QQuickTouchPoint*>(obj)->setPressed(false);
+        emit canceled(_touchPoints.values());
         emit touchPointsCanceled(_touchPoints.values());
         clearTouchLists();
         foreach (QObject *obj, _touchPoints) {
index dbce428..d182ab8 100644 (file)
@@ -217,15 +217,21 @@ public:
     }
 
 Q_SIGNALS:
-    void touchPointsPressed(const QList<QObject*> &touchPoints);
-    void touchPointsUpdated(const QList<QObject*> &touchPoints);
-    void touchPointsReleased(const QList<QObject*> &touchPoints);
-    void touchPointsCanceled(const QList<QObject*> &touchPoints);
+    void pressed(const QList<QObject*> &touchPoints);
+    void updated(const QList<QObject*> &touchPoints);
+    void released(const QList<QObject*> &touchPoints);
+    void canceled(const QList<QObject*> &touchPoints);
     void gestureStarted(QQuickGrabGestureEvent *gesture);
     void touchUpdated(const QList<QObject*> &touchPoints);
     void minimumTouchPointsChanged();
     void maximumTouchPointsChanged();
 
+    //### deprecated, will be removed for 5.0
+    void touchPointsPressed(const QList<QObject*> &touchPoints);
+    void touchPointsUpdated(const QList<QObject*> &touchPoints);
+    void touchPointsReleased(const QList<QObject*> &touchPoints);
+    void touchPointsCanceled(const QList<QObject*> &touchPoints);
+
 protected:
     void touchEvent(QTouchEvent *);
     bool childMouseEventFilter(QQuickItem *i, QEvent *event);
index 5db3770..9c9132d 100644 (file)
@@ -24,7 +24,7 @@ Flickable {
             TouchPoint { id: point2; objectName: "point2" }
         ]
 
-        onTouchPointsCanceled: cancelCount = touchPoints.length
+        onCanceled: cancelCount = touchPoints.length
         onTouchUpdated: touchCount = touchPoints.length
     }
 }
index 85f8cd6..54b160c 100644 (file)
@@ -20,9 +20,9 @@ MultiPointTouchArea {
 
     maximumTouchPoints: 5
 
-    onTouchPointsPressed: { touchPointPressCount = touchPoints.length }
-    onTouchPointsUpdated: { touchPointUpdateCount = touchPoints.length }
-    onTouchPointsReleased: { touchPointReleaseCount = touchPoints.length }
+    onPressed: { touchPointPressCount = touchPoints.length }
+    onUpdated: { touchPointUpdateCount = touchPoints.length }
+    onReleased: { touchPointReleaseCount = touchPoints.length }
     onTouchUpdated: {
         touchCount = touchPoints.length
         touchUpdatedHandled = true