Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Drag and drop in TableView : the correct way

    QML and Qt Quick
    1
    2
    845
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      Nitenq last edited by

      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.active: dragArea.drag.active
                  Drag.mimeData: { "text/uri-list": "sound.wav" }
                  Drag.dragType: Drag.Automatic
      
                  MouseArea {
                      id: dragArea
                      anchors.fill: parent
                      drag.target: parent
                      propagateComposedEvents:true
      
                  }
                  Text {
                      anchors.verticalCenter: parent.verticalCenter
                      color: styleData.textColor
                      elide: styleData.elideMode
                      text: styleData.value
                  }
      }
      
      1 Reply Last reply Reply Quote 0
      • N
        Nitenq last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • First post
          Last post