From d054755e9e452df05fb590510d25bf4167b97af7 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 26 Apr 2013 16:18:54 +0200 Subject: Fix hover after press event When a mouse press event was rejected, we would unconditionally cancel the hover and claim that the mouse is not contained any more. Instead check if the mouse left and only then cancel the hover state. Task-number: QTBUG-30783 Change-Id: I5fac6f3a1f2807ef03e07982c603492d40d2a249 Reviewed-by: Florian Boucault Reviewed-by: Alan Alpert --- .../quick/qquickmousearea/data/hoverAfterPress.qml | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml (limited to 'tests/auto/quick/qquickmousearea/data') diff --git a/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml b/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml new file mode 100644 index 0000000000..69ec8fbd47 --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml @@ -0,0 +1,29 @@ +import QtQuick 2.0 + +Item { + width: 500 + height: 500 + + Rectangle { + width: 300 + height: 300 + color: "grey" + x: 100 + y: 100 + + MouseArea { + id: mouseArea + objectName: "mouseArea" + anchors.fill: parent + hoverEnabled: true + onPressed: mouse.accepted = false + //onContainsMouseChanged: print("containsMouse changed =", containsMouse) + + Rectangle { + visible: parent.containsMouse + color: "red" + width: 10; height: 10 + } + } + } +} -- cgit v1.2.3