0

After upgrade from Qt 5.4.1 to 5.9.1 the following code has changed behavior when using a touchscreen:

import QtQuick 2.1
import QtQuick.Window 2.2

Window {
    visible: true
    width: flick.width + 2*grid.spacing
    height: flick.height + 2*grid.spacing

    property int rectHeight: 65
    property int rectWidth: 100

    Flickable {
        id: flick
        pressDelay: 100
        contentWidth: grid.width
        anchors {
            top: parent.top
            left: parent.left
            leftMargin: grid.spacing
            topMargin: grid.spacing
        }

        height: rectHeight * grid.rows + grid.spacing * (grid.rows-1)
        width: rectWidth * (3 + 0.5) + grid.spacing * 3

        Grid {
            id: grid
            rows: 6
            columns: 12
            spacing: 12

            Repeater {
                id: repeater
                model: parent.rows * parent.columns
                Rectangle {
                    color: "#3333FF"
                    width: rectWidth
                    height: rectHeight

                    MouseArea {
                        anchors.fill: parent
                        onPressed: console.log("onPressed")
                        onReleased:console.log("onReleased")
                        onClicked: console.log("onClicked")
                    }
                }
            }
        }
    }
}

Previously with Qt 5.4.1 and using mouse or touchscreen to click a Rectangle it prints:

qml: onPressed
qml: onReleased
qml: onClicked

Currently with Qt 5.9.1 and using mouse it still works the same when clicking the rectangle:

 qml: onPressed
 qml: onReleased
 qml: onClicked

But with Qt 5.9.1 and using a touchscreen to click a Rectangle it only prints

 qml: onPressed

Not sure why the signals released and clicked are no longer emitted when using a touchscreen, but for my code I still need them to be emitted.

If I change

pressDelay: 0

Then the mouseArea emitted all 3 signals when clicked, but this is not a solution for me since this results in the pressed signal getting emitted from the mousearea when flicking.

buggex
  • 9
  • 4
  • 2
    QML's touch was fundamentally broken when android 6 came out. The fix involves redesigning it from the ground up, which may be the cause of your problem. – dtech Sep 18 '17 at 16:42
  • You may consider, filing a bug report on https://bugreports.qt.io – derM - not here for BOT dreams Sep 19 '17 at 06:17
  • https://bugreports.qt.io/browse/QTBUG-63282 – buggex Sep 19 '17 at 07:03
  • 1
    @dtech Uh? I've been developing for more than 2 years for Android 6+ devices (my current one is on 8.0) and I haven't encountered issues about touch. What are you talking about? – GrecKo Sep 19 '17 at 07:35
  • So you have developed for more than 2 years without noticing that if you have 2 mouse areas, and quickly click the first then the second, the second will register a double click? https://bugreports.qt.io/browse/QTBUG-57603 https://bugreports.qt.io/browse/QTBUG-60511 – dtech Sep 19 '17 at 08:38
  • Also https://bugreports.qt.io/browse/QTBUG-58170, and those are just the ones I personally stumbled upon, there are actually a lot more issues with touch input in qml. – dtech Sep 19 '17 at 08:49
  • Yes, I haven't run in those situations. I've seen people complain about those though, I just forgot about it. I can reproduce OP's problem on Android but OP is experiencing it on Windows, so it may or may not be related to Android behaviour changes. A `cancelled` event is sent by the `MouseArea`, most likely because of the `Flickable` stealing the event. – GrecKo Sep 19 '17 at 09:00
  • I just noted when the broken behavior in touch became apparent, a poorly designed touch api will have issues on all platforms. For example the bogus double click issue has to do with the fact touch is handled in a very much "mouse cursor emulation" manner rather than actual touch, thus the inability to differentiate where the clicks originate. And it was 5.9 when they started attempting to fix that implementation, which is consistent with the OP's regression. – dtech Sep 19 '17 at 09:06
  • Wording wasn't optimal thou, it sounds as if android somehow broken qt, which doesn't make sense, but still. In retrospect it should have been something like `changes in android 6 made obvious the fundamentally broken touch input` – dtech Sep 19 '17 at 09:13

0 Answers0