Event propegation issue between MouseArea and MultiPointTouchArea



  • Hello,

    I have a question regarding the following problem that I'm having between mouse area and multitouch area. The problem that I'm having
    is that mouse area does not detect the onClicked. There is a mouseEnabled property that allows you to handle mouse events(if true) or
    allow pass through of the events so that they can be handled by other items underneath(if false). This pass through isn't working in my
    situation.

    Does anybody have an idea why the multitouch area does not propegate the events to the mouse area.

    Thank you in advance for the help.

    Qml code(main.qml):

    Window {
    
        id: mainWindow
    
        width: 1024
        height:  768
        minimumWidth: width
        minimumHeight: height
        maximumWidth: width
        maximumHeight: height
    
        MouseArea {
            anchors.fill: parent
            onClicked: {
                console.log(mouse.x)
            }
        }
    
        MultiPointTouchArea {
            anchors.fill: parent
            mouseEnabled: false
    
            onTouchUpdated: {
                console.log("onTouchUpdated")
            }
    
            onPressed: {
                console.log("onPressed")
            }
    
            onReleased: {
                console.log("onReleased")
            }
    
            onUpdated: {
                console.log("onUpdated")
            }
    
            minimumTouchPoints: 2
            maximumTouchPoints: 2
    
            touchPoints: [
                TouchPoint { id: point1 },
                TouchPoint { id: point2 }
            ]
        }
    }
    


  • Just did some testings with your code and it works for me, if the Window is a top level, else it will fail, not sure if it's a bug. Also works if the window is a Rectangle. Maybe you can change to Rectangle ?



  • Your code works for me. Are you using a touchscreen for testing? From my experience a MultiPointTouchArea can distinguish between a mouse click and a "touch click". The mouseEnabled property only works for actual mouse clicks, not a touch.


Log in to reply
 

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