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

MouseArea press is not canceled when enabled becomes false

    XMLWordPrintable

Details

    Description

      MouseArea does not get canceled if it's disabled while in pressed state. This can be easily observed (from the logs) with the following QML. Just press and hold on the mouse area for over a second. After this you won't get onCanceled nor onReleased signals. Also "pressed" property stays true.

      MouseArea {
          width: 100; height: 100
          onPressedChanged: {
              console.log("mouseArea.pressed: " + pressed)
              if (pressed) {
                  disableTimer.restart()
              } else {
                  disableTimer.stop()
              }
          }
      
          onPressed: console.log("mouseArea.onPressed")
          onReleased: console.log("mouseArea.onReleased")
          onCanceled: console.log("mouseArea.onCanceled")
          onEntered: console.log("mouseArea.onEntered")
          onExited: console.log("mouseArea.onExited")
          onClicked: console.log("mouseArea.onClicked")
      
          Timer {
              id: disableTimer
              interval: 1000
              onTriggered: parent.enabled = false
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              martinj Martin Jones
              Votes:
              10 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes