[Interest] Cannot drag a Pane in Qml even on Qt 6.X

Nuno Santos nuno.santos at imaginando.pt
Mon Mar 6 09:55:05 CET 2023


It was not possible to drag a Pane on Qt 5.X

But I was almost convinced it was possible to do it on Qt 6.X

But now I have tried again and it seems it is not possible. Or maybe I’m doing something wrong.

Is there any strong reason a Pane cannot be draggable?



import QtQuick
import QtQuick.Layouts
import QtQuick.Controls

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Item {
        width: 200; height: 200

        DropArea {
            x: 75; y: 75
            width: 50; height: 50

            Rectangle {
                anchors.fill: parent
                color: parent.containsDrag ? "green" : "gray"

        //Rectangle {
        Pane {
            x: 10; y: 10
            width: 20; height: 20
            //color: "red"

            Drag.active: dragArea.drag.active
            Drag.hotSpot.x: 10
            Drag.hotSpot.y: 10

            MouseArea {
                id: dragArea
                anchors.fill: parent

                drag.target: parent

More information about the Interest mailing list