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

Inconsistent enabled behavior

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.0.2
    • None

    Description

      The issue can be reproduced with the following snippet:

      import QtQuick 2.0
      
      Item {
          id: wrapper
          width: 400; height: 400
      
          MouseArea {
              id: mouseArea
              anchors.fill: parent
              onPressed: console.log("pressed")
              onReleased: console.log("released")
              onCanceled: console.log("canceled")
          }
      
          // simulate outside event
          Timer {
              interval: 2000
              running: true
              onTriggered: {
                  console.log("triggered")
                  mouseArea.enabled = false
                  //wrapper.enabled = false
              }
          }
      }
      

      To reproduce:

      1. Start the example
      2. Press the mouse
      3. Wait for the timer to fire
      4. Release the mouse

      When using mouseArea.enabled = false the following output occurs:

      pressed
      triggered
      released

      When using wrapper.enabled = false the following output occurs instead:

      pressed
      triggered
      canceled

      In my case, the wrapper behavior is what I was wanting from the MouseArea. This basic issue is also noted in QTBUG-29783. As mentioned there, the current MouseArea behavior was changed to fix a bug, however, I don't believe the difference in behavior between MouseArea and other Items was intentional.

      If this behavior cannot be changed, it would be nice to have the difference documented.

      Attachments

        Issue Links

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

          Activity

            People

              aalpert Alan Alpert
              mbrasser Michael Brasser
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes