Nominate our 2022 Qt Champions!

How to use Drag.Automatic

  • Hi Guys,

    Just updated to 5.2 and eager to test external drag and drop but want to better understand Drag.Automatic. Right now I have this code sample:

    @Item {
    id: draggable
    width : 50;
    height : 50;
        Drag.mimeData: { "text/plain": "test" }
        //Drag.dragType: Drag.Automatic
        Rectangle {
            anchors.fill: parent
            color : "red"
        MouseArea {
            id: mouseArea
            anchors.fill: parent

    It works as expected, I can drag a red rectangle around. But if I un-comment

    @Drag.dragType: Drag.Automatic@

    now the rectangle does not move during the drag and will only change its position when I release the mouse.

    Do I need to do something else to make it move during the drag and not only when I drop?

    Thanks a lot!

Log in to reply