Drag and drop bug in Linux?
-
I am using a Linux Mint 20.1 to test my app in a linux environment and for some reason the drag and drop for text is not working as the mimeData()->text() is always empty.
This is the code used to enable the drag and drop.
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); this->setAcceptDrops(true); //... } void MainWindow::dragEnterEvent(QDragEnterEvent *event) { if(event->mimeData()->hasFormat("text/plain")) { event->acceptProposedAction(); } } void MainWindow::dropEvent(QDropEvent *event) { if( ! isProcessingLink) { qDebug() << event->mimeData()->text(); // empty processLink(event->mimeData()->text()); } event->acceptProposedAction(); }On windows this works fine but in linux there's no text.
I am using Qt 6.2.0
-
Hi,
Did you check the type of the mime data you are getting ?
-
That wasn't my question. What are the types that have been registered in the mine data object ? There might be a difference there.
-
That wasn't my question. What are the types that have been registered in the mine data object ? There might be a difference there.
-
-
Did you check what QMimeData::data returns for each type ?
-
Did you check what QMimeData::data returns for each type ?
@SGaist Sorry for the late reply
I did that and it returned everything ok for each type. So I did this:
processLink(event->mimeData()->data("text/plain"));And it is working great. I don't know why
mimeData()->text()is returning empty, can it be a bug?