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

DragHandler doesn't account for scene changes when calculating threshold

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.9
    • Quick: Other
    • None

    Description

      When the scene is rotated and an axis is disabled, drag doesn't activate on the proper axis.

      Steps to Reproduce:

      • Run the snippet
      • Start dragging the first ball exclusively over the scene's Y axis
      • Try to drag the ball over the scene's X axis
      • Then try to drag the ball over the scene's Y axis again

      EXPECTED
      DragHandler activates on the proper axis movement relative to the DragHandler.

      ACTUAL
      When the scene is rotated 90 degrees, DragHandler activates only on the disabled axis, although it correctly calculates the drag distance from the proper one after that.

      import QtQuick 2.15
      
      Rectangle {
          color: "#333"
          height: 480
          objectName: "dragRotation"
          rotation: 90
          width: 480
      
          Rectangle {
              id: ballX
      
              color: dragHandlerX.active ? "blue" : "lightsteelblue"
              height: 80
              objectName: "ballX"
              radius: width / 2
              width: 80
              x: 100
              y: 200
      
              DragHandler {
                  id: dragHandlerX
      
                  cursorShape: Qt.IBeamCursor
                  xAxis.enabled: true
                  yAxis.enabled: false
              }
              Text {
                  anchors.centerIn: parent
                  color: "white"
                  horizontalAlignment: Text.AlignHCenter
                  text: ballX.objectName + "\n" + dragHandlerX.centroid.position.x.toFixed(1) + "," + dragHandlerX.centroid.position.y.toFixed(1) + "\n" + ballX.x.toFixed(1) + "," + ballX.y.toFixed(1)
              }
          }
          Rectangle {
              id: ballY
      
              color: dragHandlerY.active ? "blue" : "lightsteelblue"
              height: 80
              objectName: "ballY"
              radius: width / 2
              width: 80
              x: 300
              y: 200
      
              DragHandler {
                  id: dragHandlerY
      
                  cursorShape: Qt.IBeamCursor
                  xAxis.enabled: false
                  yAxis.enabled: true
              }
              Text {
                  anchors.centerIn: parent
                  color: "white"
                  horizontalAlignment: Text.AlignHCenter
                  text: ballY.objectName + "\n" + dragHandlerY.centroid.position.x.toFixed(1) + "," + dragHandlerY.centroid.position.y.toFixed(1) + "\n" + ballY.x.toFixed(1) + "," + ballY.y.toFixed(1)
              }
          }
      }
      

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            minimonium Alexandr Timofeev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change