#include #include #include #include #include #include #include #include int main(int argc, char* argv[]) { QApplication app(argc, argv); QList urls; for (int i = 1; i < argc; ++i) { QFileInfo file(QFile(argv[i])); if (file.exists()) { urls << QUrl("file:" + file.absoluteFilePath()); } else { qInfo() << file.filePath() << "does not exist"; } } if (urls.empty()) { return 0; } QMimeData* mimeData = new QMimeData(); mimeData->setUrls(urls); QDrag drag(&app); drag.setMimeData(mimeData); drag.exec(); }