Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Drag and drop in TableView : the correct way

Drag and drop in TableView : the correct way

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 1.2k Views
  • 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 Offline
    N Offline
    Nitenq
    wrote on last edited by
    #1

    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
    0
    • N Offline
      N Offline
      Nitenq
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved