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. Propagate mouse events to items bellow a MouseArea instance
Forum Updated to NodeBB v4.3 + New Features

Propagate mouse events to items bellow a MouseArea instance

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 8.0k 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.
  • I Offline
    I Offline
    ixSci
    wrote on last edited by
    #1

    Hello all!

    Given: Some QML items(let it be Rectangles for simplicity), MouseArea which fills all QML items occupied space.

    Goal: Handle mouse clicking on the top MouseArea and in the below Rectangles.

    A little scratch:
    @import QtQuick 1.0

    Item{
    width: 100
    height: 100
    Rectangle{
    anchors.fill: parent
    color: "yellow"
    MouseArea{
    anchors.fill: parent
    onClicked: parent.color = "red"
    }
    }
    MouseArea{
    z: 1
    anchors.fill: parent
    onClicked: mouse.accepted = false
    }
    }@

    According to the scratch I want the Rectangle turns to the red colour. How can I achieve that?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      It was discussed couple of times here at DevNet and also you can find an "issue":http://bugreports.qt.nokia.com/browse/QTBUG-15900 in bugtracker.

      UPD: Another "issue":http://bugreports.qt.nokia.com/browse/QTBUG-13007 in bugtracker. Also couple of topics:

      • "http://developer.qt.nokia.com/forums/viewthread/866":http://developer.qt.nokia.com/forums/viewthread/866
      • "http://developer.qt.nokia.com/forums/viewthread/1468":http://developer.qt.nokia.com/forums/viewthread/1468
      1 Reply Last reply
      0
      • I Offline
        I Offline
        ixSci
        wrote on last edited by
        #3

        Thank you Denis. But it is a little strange that trolls react so slow on that bug. In according to the bug report it has already took 2 months but it still wasn't evaluated.
        Besides, what did the developers mean by the MouseEvent.accepted property if it has never worked.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          You can find a possible workaround in second issue I've mentiond in my comment. Maybe it will help you.

          1 Reply Last reply
          0
          • I Offline
            I Offline
            ixSci
            wrote on last edited by
            #5

            It is getting more clear. "This":http://bugreports.qt.nokia.com/browse/QTBUG-13007 bug report is more appropriate to the case. Obviously, until the bug(feature) is not fixed it should be documented because accepted property is confusing.

            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