Nested MultiPointTouchArea and MouseArea: grab and cancel



  • Hello,

    I have a simple UI with MouseArea and flickable (drag, click and double click) and I want to catch some more complexe gestures with 3 and 4 fingers. I added 2 MultiPointTouchArea to do this job. My code looks like this:

    import QtQuick 2.0
    Rectangle {
        width: 900
        height: 900
        MultiPointTouchArea {
            id: touch4
            anchors.fill: parent
            minimumTouchPoints: 4
            maximumTouchPoints: 4
            onGestureStarted: gesture.grab()
            // Some gesture processing with touchPoints and pressed, released and canceled
            MultiPointTouchArea {
                id: touch3
                anchors.fill: parent
                minimumTouchPoints: 3
                maximumTouchPoints: 3
                onGestureStarted: gesture.grab()
                // Some gesture processing with touchPoints and pressed, released and canceled
                SimpleUI {
                    anchors.fill: parent
                    // Contains MouseArea and flickable
                }
            }
        }
    }
    

    I call gesture.grab() function on signal gestureStarted to prevent drag with MouseArea or flickable in my SimpleUI.
    But grab gesture have variable consequences.
    When touch3 grab gesture, everything seems to work well. But I think I have some issues with touch4.
    When touch4 grab gesture, mouse area in my simpleUI is cancel but not touch3 (touch3 received pressed event, so I think it should be cancel too).
    Some times, touch4 should grab gesture but onGestureStarted is not called and when I release my fingers, touch4 is canceled. In this case, I dont touch the screen any more but the mouseArea still in pressed state. If I touch the screen the mouseArea do nothing. I have to proceed a 4 fingers gesture again, touch4 grab gesture and when I release my fingers, the mouseArea is canceled.

    I expect when a MultiPointTouchArea grab a gesture, all other area previously pressed are canceled and when I release, everyone is released or canceled, but its not :(

    Do I something wrong with my nested system ? Are there bugs in touch event processing ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.