diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-11-07 12:42:12 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-12-04 12:26:10 +0100 |
commit | 75b6ef710cddbf9395df35650438f0feb57ec076 (patch) | |
tree | a9efb9180d8eb86f2badc138b58fe62b9c7e7bdc /tests/auto/controls | |
parent | 463898f0765b83f6c391f6802a0ee06796f9f6d2 (diff) |
SplitView: fix hoverable child items breaking handle hover state
Detect HoverEnter events by filtering the mouse events of child items,
and respond by clearing any hovered handle.
Change-Id: Ice7e7fe3cc4c9224064c2384cd832e4a7d91c4da
Fixes: QTBUG-79846
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/controls')
-rw-r--r-- | tests/auto/controls/data/tst_splitview.qml | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_splitview.qml b/tests/auto/controls/data/tst_splitview.qml index c125b99e..74e4c68e 100644 --- a/tests/auto/controls/data/tst_splitview.qml +++ b/tests/auto/controls/data/tst_splitview.qml @@ -2026,4 +2026,55 @@ TestCase { compare(control.repeater.count, 3) compare(control.contentChildren.length, 3) } + + Component { + id: hoverableChildrenSplitViewComponent + + SplitView { + handle: handleComponent + anchors.fill: parent + + MouseArea { + objectName: "mouseArea1" + hoverEnabled: true + + SplitView.preferredWidth: 200 + } + MouseArea { + objectName: "mouseArea2" + hoverEnabled: true + } + } + } + + function test_hoverableChilden() { + if (Qt.platform.pluginName === "offscreen" || Qt.platform.pluginName === "minimal") + skip("Mouse hovering not functional on offscreen/minimal platforms") + + var control = createTemporaryObject(hoverableChildrenSplitViewComponent, testCase) + verify(control) + + verify(isPolishScheduled(control)) + verify(waitForItemPolished(control)) + + // Move the mouse over the handle. + var handles = findHandles(control) + var targetHandle = handles[0] + // Test fails if we don't do two moves for some reason... + mouseMove(targetHandle, targetHandle.width / 2, targetHandle.height / 2) + mouseMove(targetHandle, targetHandle.width / 2, targetHandle.height / 2) + verify(targetHandle.SplitHandle.hovered) + + // Move the mouse to the MouseArea on the left. The handle should no longer be hovered. + mouseMove(control, 100, control.height / 2) + verify(!targetHandle.SplitHandle.hovered) + + // Move the mouse back over the handle. + mouseMove(targetHandle, targetHandle.width / 2, targetHandle.height / 2) + verify(targetHandle.SplitHandle.hovered) + + // Move the mouse to the MouseArea on the right. The handle should no longer be hovered. + mouseMove(control, control.width - 100, control.height / 2) + verify(!targetHandle.SplitHandle.hovered) + } } |