Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38364

MouseArea doesn't propagate the disabled state to children

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.2.1, 5.3.0 Beta1
    • None

      QQuickMouseArea overrides QQuickItem::isEnabled and setEnabled, and has its own "d->enabled" property. This means that setting enabled to false doesn't propagate the state to its children.
      A simple fix would be to remove the overrides and rely on QQuickItem behavior, but I'm not sure i'm not missing some gotcha. Why does QQuickMouseArea reimplement them in the first place?

      Test case:

       
      import QtQuick 2.0
      
      //Item {
      MouseArea {
          id: root
          width: 200
          height: 200
          enabled: false
      
          Item {
              id: child
          }
      
          Component.onCompleted: console.log(root.enabled, child.enabled)
      }
      

      With the MouseArea as the root item the output is "false true", while with the Item as the root it is "false false"

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            srutledg Shawn Rutledge
            giucam Giulio Camuffo
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes