MouseArea range in app



  • Hi all,

    I'm starting my adventure with QML and I got small problem with MouseArea. When I want to build app with some windows (build on my own using Rectangle etc.) MouseArea are "visible" from other Rectangle window and do unexpected action. Is a elegant way to disable MouseArea after change App window? Only way I can see now is overwrite by empty MouseArea like in my example below or set "enabled" property false certain MouseArea after change app window.

    
    import QtQuick 2.0
    Rectangle {
        color: "white"
    
        Rectangle {
            color: "yellow"
            width: 100; height: 100
    
            MouseArea {
                anchors.fill: parent
                onClicked: console.log("clicked yellow")
            }
        }
    
        Rectangle {
            color: "blue"
            width: 70; height: 70
            MouseArea {
                anchors.fill: parent
            }
                Rectangle {
                    color: "red"
                    width: 20; height: 20
    
                    MouseArea {
                        anchors.fill: parent
                        //propagateComposedEvents: false
                        onClicked: {
                            console.log("clicked red")
                            //mouse.accepted = false
                        }
                    }
               }
         }
    
    }
    

Log in to reply
 

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