Answer the question
In order to leave comments, you need to log in
Why doesn't file drag-drop work in Linux when using Qt?
Good afternoon! Given: a list of files, you need to drag and drop to save it to a directory.
Made this work. It works great in Windows, but in Linux, when dragging outside the program window (into the file manager), the cursor becomes prohibitive. At the same time, in Linux, all other programs react to the file - i.e. the browser offers to save it, notepad shows the path, etc.
Dragdrop implementation (the file exists at the moment of dragging):
QUrl url = QUrl::fromLocalFile(fname);
QDrag* drag = new QDrag(this);
QMimeData* mimeData = new QMimeData;
mimeData->setUrls(QList<QUrl>() << url);
drag->setMimeData(mimeData);
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question