GIMP doesn't accept file drop from Qt app
Unsolved
General and Desktop
-
GIMP doesn't accept file drop from my Qt apps in both Windows 10 and Linux (Xubuntu / Ubuntu 15.10). What format(s) should I add to the QMimeData?
Simplified app:
Click inside the red Rectangle and drag into a GIMP window, GIMP rejects the drag.#include "win.h" #include <QApplication> #include <QDebug> #include <QDrag> #include <QMimeData> #include <QMouseEvent> #include <QPainter> Win::Win() : QWidget(0) { setFixedSize(300,300); m_rt = QRect(100,100,100,100); } void Win::mousePressEvent(QMouseEvent* e) { if (m_rt.contains(e->pos())) { m_bDndOk = true; m_d = e->pos(); } else m_bDndOk = false; } void Win::mouseMoveEvent(QMouseEvent* e) { if (m_bDndOk && (e->pos() - m_d).manhattanLength() > qApp->startDragDistance()) { QList<QUrl> ls; ls << QUrl::fromLocalFile("F:\\tmp\\a.jpg"); QMimeData* pData = new QMimeData; pData->setUrls(ls); QDrag* pDrag = new QDrag(this); pDrag->setMimeData(pData); pDrag->exec(); } } void Win::mouseReleaseEvent(QMouseEvent* e) { m_bDndOk = false; } void Win::paintEvent(QPaintEvent*) { QPainter p(this); p.fillRect(m_rt, Qt::red); }
-
-
That's the information about Qt Creator itself. It has no relation with the Qt version you are currently using to build your application.
-
The fix is stated for Qt 5.6.1 so currently you have two options to test it:
- build Qt yourself from git
- try with the 5.7 Beta.