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

WheelHandler enables itself although deactivated

    XMLWordPrintable

Details

    • All
    • 40bbf1e8fddebb0974426a03b0f48dfc08f942de (qt/qtdeclarative/dev) 42ae5a32eb384cb7042eeace193aa42637970387 (qt/qtdeclarative/6.1)

    Description

      In this code, a WheelHandler shall be deactivated as long as the DragHandler is active. While the enabled property is correctly set to false when the drag starts, it is magically re-enabled once the wheel has been used.

      How the example code produces the wrong behavior:
      1. Start dragging the purple rectangle (this disables the WheelHandler).
      2. While still dragging, move the mouse wheel.

      Expected: The WheelHandler does nothing, because it is disabled. The wheel signal should not be sent.
      Is: The WheelHandler is somehow enabled again and the wheel signal fired.

      The issue does not occur when using a static "enabled: false" in the WheelHandler, so I suspect that the point in time is crucial here.

      Please find a working minimal example in the attachment.

      WheelHandler {
          id: wheelHandler
          enabled: !dragHandler.active
          target: null
          onWheel: appWin.scaleFactor += event.angleDelta.y / 1000
          onEnabledChanged: console.log('WheelHandler enabled', wheelHandler.enabled)
      }
      
      DragHandler {
          id: dragHandler
          target: sampleRect
          onActiveChanged: console.log('DragHandler active', dragHandler.active)
      }
      

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            moerkb Markus Bader
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes