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

Incorrect behavior of Drag.MaximumX if item is near maximum X

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9
    • 5.7.1, 5.8.0
    • None
    • Windows 7 mvsc2013, macOS 10.12.2

    Description

      If you drag an item too close (5-10 px) of its maximum X (defined by drag.maximumX) and then release the mouse, you will not be able to drag it to the maximumX (unless you first drag the item away from the maximumX, and then drag the item to it).

      The red rectangle in the screenshot cannot go thought its container (in blue). You will not be able to drag it to the right, unless you drag it first a tiny bit to the left.

      The problem also occurs with minimumX.

      This bug can easily be reproduced by downloading the zip file, or executing the following code :

      import QtQuick 2.7
      import QtQuick.Window 2.2
      
      Window {
          visible: true
          width: 350; height: 50
          Rectangle {
              id: container
              width: 300; height: 50
      
              color: "blue"
      
              Rectangle {
                  id: rect
                  width: 50; height: 50
                  color: (x >= 290 -width && x < 300-width) ? "red" : "green"
      
                  MouseArea {
                      anchors.fill: parent
                      drag.target: rect
                      drag.axis: Drag.XAxis
                      drag.minimumX: 0
                      drag.maximumX: container.width - rect.width
                  }
              }
          }
      }
      
      • Try to move the green rectangle around (without releasing your mouse) to see that maximumX and minimumX are working as intended.
      • Now move the green rectangle to the right until it turns red, release the mouse, and then try to drag it to the right.

      Attachments

        1. drag.png
          drag.png
          14 kB
        2. untitled.zip
          671 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            wearyinside Oleg Yadrov
            blabbe Boris LABBE
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes