Drag&Drop using QFileSystemModel.
Solved
General and Desktop
-
Hello
I have a widget containing 2 QTableView. each has QFileSystemModel object as model.
I want to have a possibility of copying files from one view to another using drag&drop.
I have set this for both views:tableView_ -> setDragEnabled(true); tableView_ -> setAcceptDrops(true); tableView_ -> setDropIndicatorShown(true);
then I reimplemented those methods(Do I really need it?):
void dropEvent(QDropEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dragEnterEvent(QDragEnterEvent *event);items on the view are dragging ok but when i drop it it doesn't copy anything and does nothing. how can I use QFileSystemModel D&D then I have QTableView. What I have to do?
-
Hi
Have you tried to set
readOnly
to false. Doc says its default
true.
http://doc.qt.io/qt-5/qfilesystemmodel.html#readOnly-propI dont think you need to implement dropXXX