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

DragHandler and other handlers don't immediately deactivate

    XMLWordPrintable

Details

    • All

    Description

      When setting enabled property to false on an active Drag handler, it won't be until the next pointer move event that the active flag will be reset. For example, if a user starts dragging an item, but then holds it still in place, and during that time enabled is assigned false somehow, then a handler would temporarily hang in an inconsistent state with enabled: false; active: true.

      Expected behavior: The active property should be immediately reset to false, and any currently ongoing operations cancelled.

      Reproducible snippet: 

      import QtQuick 2.15
      import QtQuick.Window 2.15
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle {
              focus: true
              width: 50
              height: 50
              color: "red"
      
              DragHandler {
                  id: dragHandler
                  onActiveChanged: print("DRAG ACTIVE", active, "ENABLED", enabled);
                  onEnabledChanged: print("DRAG ENABLED", enabled, "ACTIVE", active);
              }
      
              Keys.onSpacePressed: dragHandler.enabled = !dragHandler.enabled;
          }
      }
      

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ratijas ivan tkachenko
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes