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

QML Drag.Automatic doesn't work properly on Linux

    XMLWordPrintable

Details

    • 17650467302819e1fd333f0682445d50fc52eb68

    Description

      The attached example works on Windows and Mac, but not Linux.

      On Windows and Mac, you can press/drag/release the 0 into the green DropArea followed by doing the the same with the 1:
      qml: onDropped text0
      qml: onDropped text1

      On Linux, after releasing the 0 in the green DropArea, the 0 moves with the mouse, and attempting to press/drag/release the 1 results in the 0 being dropped again:
      qml: onDropped text0
      qml: onDropped text0

      The only ways to get out of this situation are to move the window via its title bar or click on empty white space. The issue has been present since Qt 5.2.x.

      import QtQuick 2.0
      
      ListView {
          width: 400;  height: 400
      
          model: 2
              
          delegate: Text {        
              text: index
              color: mouseArea.containsMouse ? "blue" : "black"
              font.pixelSize: 100
      
              MouseArea {
                  id: mouseArea
                  hoverEnabled: true
                  anchors.fill: parent
                  drag.target:  parent
              }
      
              Drag.active:   mouseArea.drag.active
              Drag.dragType: Drag.Automatic
              Drag.mimeData: {'text/plain': 'text' + index}
          }
          
          Rectangle{//drop target
              width: 100;  height: 100
              color: 'green'
              anchors.bottom: parent.bottom
              opacity: dropArea.containsDrag? 0.1: 0.5
              
              DropArea{
                  id: dropArea
                  anchors.fill: parent
                  onDropped: print('onDropped', drop.text)
              }
          }
      }
      

      Attachments

        1. DragTest.png
          DragTest.png
          6 kB
        2. DragTest.qml
          0.9 kB
        3. qtbug46361_diag.diff
          6 kB
        4. qtbug46361.tar.gz
          0.9 kB

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              chriscortopassi Chris Cortopassi
              Votes:
              3 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes