Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. GIMP doesn't accept file drop from Qt app
Qt 6.11 is out! See what's new in the release blog

GIMP doesn't accept file drop from Qt app

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M Wong
    wrote on last edited by
    #1

    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);
    }
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Might be related to QTBUG-45812

      Which version of Qt are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M Wong
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's the information about Qt Creator itself. It has no relation with the Qt version you are currently using to build your application.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            M Wong
            wrote on last edited by
            #5

            The Qt installer I used is:

            qt-opensource-windows-x86-msvc2015_64-5.6.0.exe

            so I believe the Qt version is 5.6.0

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved