[Interest] DragDrop between different processes not working?

Wilhelm wilhelm.meier at fh-kl.de
Wed Dec 17 07:18:05 CET 2014

Hi all,

below is a stripped-down example for drag/drop. It follows the Qt
examples. It works if I drag from the ListView widget to another widget
(e.g. QTextEdit) of the same(!) process. But it doesn't work if I drag
to another(!) process - with the same programm or another, e.g. kate.

So, obviously I'm missing something to enable drag/drop between
processes. But I can't figure out what - I think it must be very basic!

Can anyone help?

void ListView::mouseMoveEvent(QMouseEvent* event)
    if (!(event->buttons() & Qt::LeftButton)) {
    if ((event->pos() - mMousePressPosition).manhattanLength() <
QApplication::startDragDistance()) {
    QDrag* drag = new QDrag(this);
    QMimeData* mimeData = new QMimeData;

    mimeData->setUrls(QList<QUrl>() << QUrl::fromLocalFile("./test.cc"));


    qDebug() << Q_FUNC_INFO << mimeData->text();
    qDebug() << Q_FUNC_INFO << mimeData->urls();

    Qt::DropAction dropAction = drag->exec(Qt::CopyAction |
Qt::MoveAction, Qt::CopyAction);

    qDebug() << Q_FUNC_INFO << "drop:" << dropAction;

w.meier at unix.net

More information about the Interest mailing list