How can I drag a file out of a TreeView and into another application?
I have a Treeview with QStandardItems. Each item has a path url to a local audio file and I am not sure how to add the ability to drag on of those items into another app like VLC.
I am subclassing the TreeView class and overriding these methods
//Mouse press event, start drag event
void mousePressEvent(QMouseEvent* event) override;
// //drag operation in the form move event
void dragMoveEvent(QDragMoveEvent* event) override;
// //drag operation enters the form
void dragEnterEvent(QDragEnterEvent* event) override;
void dragLeaveEvent(QDragLeaveEvent* event) override;
// //drop release event
void dropEvent(QDropEvent* event) override;
Still whenever I drag out an Item is is disabled
Re: How can I drag a file out of a TreeView and into another application?
Hi, please show us how you create your QDrag object.
Ginsengelf
Re: How can I drag a file out of a TreeView and into another application?
Quote:
Still whenever I drag out an Item is is disabled
If you do not create your QDrag object with QMimeData of the correct MIME type for VLC (or whatever the other app expects), then the other app will not accept it. So as Ginsengelf says:
Quote:
please show us how you create your QDrag object.