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 Inside Dynamic Height Item

MouseArea Inside Dynamic Height Item

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 392 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    rchamberlin
    wrote on last edited by
    #1

    I am creating a modal dialog for our embedded application. When a user touches outside of the modal, the modal should be hidden.

    Here is some sample code:

    Item {
    width: parent.width
    clip: true

    Rectangle {
        id: overlay
        anchors.fill: parent
        color: "#000"
        opacity: 0.8
        clip: true
    
        MouseArea {
            anchors.fill: parent
            onClicked: showDiag = false
        }
    }
    
    Rectangle {
        id: contentWrapper
        width: parent.width * 0.85
        height: childrenRect.height
        clip: true
        border.width: 5
        border.color: "#000"
        anchors.centerIn: parent
        radius: 5
        color: "#ddd"
    
        Column {
            width: parent.width
            spacing: 5
            anchors {
                left: parent.left
                right: parent.right
                leftMargin: 15
                rightMargin: 15
            }
    
        // ITEMS GO HERE...
        }
    
    }
    

    }

    My issue is that if you click inside of the "contentWrapper" box, the MouseArea underneath it is triggered, and the window gets hidden. Is there a way that I can block that interaction? I can't use another MouseArea inside of "contentWrapper" because it's a dynamic height and I'll get a binding loop.

    Any help would be appreciated.

    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