Drag&Drop using QFileSystemModel.

  • 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?

  • Lifetime Qt Champion

    Have you tried to set
    to false. Doc says its default

    I dont think you need to implement dropXXX

  • @mrjj
    Thank you that is ok now.

  • Lifetime Qt Champion

    so it can copy files on its own ?
    Doc hinted it, but I was not sure.

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.