QML Drag/drop support is about to become a lot better, accepting external drop events!

by markg85


Up until this very moment the QML drag/drop support is kinda limited. You can only use it within the app’s context. Not many know, but “Chris Meyer” is currently working on this issue and has already send a patch:

Add support for external drag and drop in Quick items.

Add startExternal and mimeData to Drag item to enable external drags.

Call startExternal to change from internal drag to external drag with
mimeData specified in the mimeData property as mime-type / data pairs.

Allow DropArea to receive and process external data.

Introduced new variable containsDrag to QQuickDropAreaPrivate. This
replaces mimeData which was previously being used to determine if a
drop operation was currently occurring. The problem was that mimeData
was being externally destructed.

Also introduced accessor methods for getting color, html, image, text,
and urls out of the drop. This facilitates dropping of external data of
those types onto a DropArea.

Task-number: QTBUG-27498

Change-Id: Icd172a5380e0f86d8011a164ce0a461ee5763cb5

It seems to be targeted for Qt 5.0.x so i guess this will end up in the next patch releases of both Qt 5.0.x and 5.1.x. So why am i posting this? This is – imho – the last remaining bit that prevented QML from being truly useful for desktop applications. With this in place along with all of the other awesome Qt 5.1.x goodies, QML is finally mature enough to really serve desktop applications without much (or any) additional hacks.

Oke, it still needs to have stock clipboard support, but that is already fairly simple to implement yourself.