implement drag and drop files and directory to qlistwidget
-
-
hi
This shows for mainwindow but is the same for any widget
http://stackoverflow.com/questions/14895302/qt-drag-drop-add-support-for-dragging-files-to-the-applications-main-window -
thank you very much @mrjj
It is the very easy solution. thanks
its my code in MainWindow#include <QMimeData> #include <QDragEnterEvent> void MainWindow::dragEnterEvent(QDragEnterEvent *e) { if (e->mimeData()->hasUrls()) { e->acceptProposedAction(); } } void MainWindow::dropEvent(QDropEvent *e) { foreach (const QUrl &url, e->mimeData()->urls()) { QString fileName = url.toLocalFile(); ui->listWidget->addItem(fileName); } }
-
Super.
Please mark as solved if possible :)