Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. MouseArea range in app
Forum Updated to NodeBB v4.3 + New Features

MouseArea range in app

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 311 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kluszon
    wrote on last edited by
    #1

    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
                        }
                    }
               }
         }
    
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved