From cebf68dd65d484e5da25ec6244f865b737778011 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 29 Jul 2011 14:40:59 +1000 Subject: Document how to have two MouseAreas simultaneously hovered. Task-number: QTBUG-17228 Change-Id: Icfb3774429f0f19084f126a0b87699f1d03220f6 Reviewed-on: http://codereview.qt.nokia.com/2369 Reviewed-by: Qt Sanity Bot Reviewed-by: Bea Lam --- .../graphicsitems/qdeclarativemousearea.cpp | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/qtquick1') diff --git a/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp b/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp index e6c22d2fbb..7f43eb1070 100644 --- a/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativemousearea.cpp @@ -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 */ -- cgit v1.2.3