Important: Please read the Qt Code of Conduct -

Drag and drop in TableView : the correct way

  • Hello

    I'm searching how to add external drag and drop support of rows in a tableview (qt QuickControl 1). And by external drag and drop I mean dragging data displayed in a row of my table view into another app (each row represent a file).

    So I added an item delegate and made it "dragable" by adding a mouse area. The drag operation works, but that breaks completely the features of the tableview : no mouse click selection, no keyboard navigation (arrows keys) anymore. I tried to play with the property propagateComposedEvents but the result is the same. Is there an easy/clean way to implement that feature ?

    Here is my code :

    //TableView code ..
            itemDelegate: Item {
                Drag.mimeData: { "text/uri-list": "sound.wav" }
                Drag.dragType: Drag.Automatic
                MouseArea {
                    id: dragArea
                    anchors.fill: parent
                Text {
                    anchors.verticalCenter: parent.verticalCenter
                    color: styleData.textColor
                    elide: styleData.elideMode
                    text: styleData.value

  • This post is deleted!

Log in to reply