mardi 21 avril 2015

Drag and drop from QTreeView to QListView with file copy in Qt5

I try to have a drag-and-drop from a Treeview (templates directory) to a Listview (project directory). I read that best solution is to implement mimeData() and dropMimeData() from Model. For now, I don't know what to put inside the functions and my test works only for drag.

I set them with as this :

Treeview :

  • model = QFileSystemModel (templates path)
  • dragEnable = true
  • dragDropMode = dragOnly
  • defaultDropAction = copyAction

Listview :

  • model = QFileSystemModel (project path) with ReadOnly=false
  • dragDropMode = dropOnly
  • sefaultDropAction = copyAction

Aucun commentaire:

Enregistrer un commentaire