GIMP doesn't accept file drop from Qt app

  • 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>
        : QWidget(0)
        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;
            QDrag* pDrag = new QDrag(this);
    void Win::mouseReleaseEvent(QMouseEvent* e)
        m_bDndOk = false;
    void Win::paintEvent(QPaintEvent*)
        QPainter p(this);
        p.fillRect(m_rt, Qt::red);

  • Lifetime Qt Champion


    Might be related to QTBUG-45812

    Which version of Qt are you using ?

  • Thanks for your reply.

    The following is from QtCreator's about box:

    Qt Creator 3.6.1
    Based on Qt 5.6.0 (MSVC 2013, 32 bit)

    Built on Mar 14 2016 09:57:09

    From revision d502727b2c

  • Lifetime Qt Champion

    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 Qt installer I used is:


    so I believe the Qt version is 5.6.0

  • Lifetime Qt Champion

    The fix is stated for Qt 5.6.1 so currently you have two options to test it:

    1. build Qt yourself from git
    2. try with the 5.7 Beta.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.