From 64dd82cdeaf0a6ad10e0fb57a7dabe73ea9cb77e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 4 Jul 2017 15:18:04 +0200 Subject: ScrollIndicator: don't block touch Unlike with mouse events there's setAcceptedMouseButtons(), currently there's no way to control whether a control receives touch events or not. As a temporary workaround until QQuickItem::setAcceptTouchEvents() has been added, we'll have to ignore touch events by hand. Task-number: QTBUG-61785 Change-Id: I9a678570bfdd104ae32b4040ecef7625dcfd1aee Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_scrollindicator.qml | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/auto/controls/data/tst_scrollindicator.qml') diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml index 54cd7159..894a035d 100644 --- a/tests/auto/controls/data/tst_scrollindicator.qml +++ b/tests/auto/controls/data/tst_scrollindicator.qml @@ -65,6 +65,11 @@ TestCase { ScrollIndicator { } } + Component { + id: mouseArea + MouseArea { } + } + Component { id: flickable Flickable { @@ -217,4 +222,26 @@ TestCase { compare(horizontal.contentItem.x, horizontal.leftPadding + 0.8 * horizontal.availableWidth) compare(horizontal.contentItem.width, 0.2 * horizontal.availableWidth) } + + // QTBUG-61785 + function test_mouseArea() { + var ma = createTemporaryObject(mouseArea, testCase, {width: testCase.width, height: testCase.height}) + verify(ma) + + var control = scrollIndicator.createObject(ma, {active: true, size: 0.9, width: testCase.width, height: testCase.height}) + verify(control) + + mousePress(control) + verify(ma.pressed) + + mouseRelease(control) + verify(!ma.pressed) + + var touch = touchEvent(control) + touch.press(0, control).commit() + verify(ma.pressed) + + touch.release(0, control).commit() + verify(!ma.pressed) + } } -- cgit v1.2.3