Document how to have two MouseAreas simultaneously hovered.
authorMichael Brasser <michael.brasser@nokia.com>
Fri, 29 Jul 2011 04:40:59 +0000 (14:40 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 29 Jul 2011 05:52:01 +0000 (07:52 +0200)
Task-number: QTBUG-17228
Change-Id: Icfb3774429f0f19084f126a0b87699f1d03220f6
Reviewed-on: http://codereview.qt.nokia.com/2369
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bea Lam <bea.lam@nokia.com>
src/qtquick1/graphicsitems/qdeclarativemousearea.cpp

index e6c22d2..7f43eb1 100644 (file)
@@ -258,12 +258,38 @@ QDeclarative1MouseAreaPrivate::~QDeclarative1MouseAreaPrivate()
 /*!
     \qmlsignal QtQuick1::MouseArea::onExited()
 
-    This handler is called when the mouse exists the mouse area.
+    This handler is called when the mouse exits the mouse area.
 
     By default the onExited handler is only called while a button is
     pressed. Setting hoverEnabled to true enables handling of
     onExited when no mouse button is pressed.
 
+    The example below shows a fairly typical relationship between
+    two MouseAreas, with \c mouseArea2 on top of \c mouseArea1. Moving the
+    mouse into \c mouseArea2 from \c mouseArea1 will cause \c onExited
+    to be called for \c mouseArea1.
+    \qml
+    Rectangle {
+        width: 400; height: 400
+        MouseArea {
+            id: mouseArea1
+            anchors.fill: parent
+            hoverEnabled: true
+        }
+        MouseArea {
+            id: mouseArea2
+            width: 100; height: 100
+            anchors.centerIn: parent
+            hoverEnabled: true
+        }
+    }
+    \endqml
+
+    If instead you give the two mouseAreas a parent-child relationship,
+    moving the mouse into \c mouseArea2 from \c mouseArea1 will \b not
+    cause \c onExited to be called for \c mouseArea1. Instead, they will
+    both be considered to be simultaneously hovered.
+
     \sa hoverEnabled
 */