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

MouseArea doesn't propagate the disabled state to children

    XMLWordPrintable

Details

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

    Description

      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"

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-38364
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes