[Interest] DragDrop between different processes not working?

Wilhelm wilhelm.meier at fh-kl.de
Wed Dec 17 11:32:45 CET 2014


Am 17.12.2014 um 10:44 schrieb Till Oliver Knoll:
> 
>> Am 17.12.2014 um 08:57 schrieb Wilhelm <wilhelm.meier at fh-kl.de>:
>>
>>> ...
>>>
>>> But just to rule out the usual suspects: does drag and drop "in general" work with your current Window Manager" (in applications where you /know/ that certain MIME types are accepted)? E.g. when you drag and drop a file from your File Manager to your Email editor: does it get "attached" (or even embedded) (in)to your current email that you are typing?
>>
>> Yes, absolutely.
>>
>> E.g. I can drag from a foreign application (e.g. dolphin) to my programm
>> (into a derived QTextEdit to accept that drops).
> 
> So just to repeat:
> 
> * Drag and Drop (DnD) works when initiated from another application (e.g.  Dolphin file manager) and dropped onto your ("drop-enabled") application/widget

yes

> 
> * DnD works within your own application instance (process)

yes

> 
> But it does not work when
> 
> * DnD initiated in your application instance 1 and dropped onto your application instance 2

yes

> 
> What exactly does not work? In instance 2, are you not getting an event at all? Or is it simply not "acceptable"? What happens if you try to drop onto another application which e.g. accepts images (email client maybe)?

I've overwritten (derived from TextEdit)

    void dragEnterEvent(QDragEnterEvent *e);
    void dragMoveEvent(QDragMoveEvent *e);
    void dropEvent(QDropEvent *e);

and in dropEvent(QDropEvent *e) I look for the mimeData like:

    if (e->mimeData()->hasText()) {
        qDebug() << Q_FUNC_INFO << "text: " << e->mimeData()->text();
        insertFromMimeData(e->mimeData());
    }

Strange is that e->mimeData()->hasText() evaluates to true but
e->mimeData()->text() is empty (similar for hasUrls() and urls()).


> 
> That is, you initiate a drag in a QLabel, place the image e.g. as "image/png" or "image/jpeg" (?) into the QMimeData and drop it over the email client? Would that work?
> 
> Cheers,
>   Oliver
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 


-- 
Wilhelm
w.meier at unix.net



More information about the Interest mailing list