Drag & Drop to external application(eg. drag from Qt app to Windows desktop/explorer)?
-
Drag & Drop to external application(eg. drag from Qt app to Windows desktop/explorer)?
i want to drag QTreeWidgetItem from my Qt app to Windows desktop/explorer, after i drop, i want to copy the file which the QTreeWidgetItem represents to the destination path of Windows desktop/explorer.
thank you -
Hi,
Why did you delete this thread just to ask the same question again ?
-
@SGaist i think ask like this is better:D
thank you!
and do you know how to do this? -
Then please, edit your original post and rephrase it, what you are doing there is just creating noise and if somebody had replied you would also generate unneeded fragmentation.
With pure Qt API ? No, I don't know, but since it's something Windows specific you should look at the native API for that part.
-
@SGaist but i startDarg in Qt app, and drop in Windows explorer...
-
Hi
To drag to explorer from Qt there must be a real file. In memory did not work for me.
This drags a Temp file to the desktop/explorer. (in win 7)#include <QtGui> #include <QLabel> class Label : public QLabel { protected: void mouseMoveEvent(QMouseEvent* event) { QTemporaryFile file; if (file.open()) { QUrl url = QUrl::fromLocalFile(file.fileName()); file.write(text().toUtf8()); file.close(); QDrag* drag = new QDrag(this); QMimeData* mimeData = new QMimeData; mimeData->setUrls(QList<QUrl>() << url); drag->setMimeData(mimeData); drag->exec(Qt::CopyAction); } } }; int main(int argc, char* argv[]) { QApplication app(argc, argv); Label label; label.setText("DRAG HERE"); label.show(); return app.exec(); }