[Development] QML DropArea documentation unhelpful
Kevin Funk
kfunk at kde.org
Wed May 14 22:04:13 CEST 2014
Hey,
I'm trying to get my head around the QML Drag and Drop API and keep finding
oddities. (I've already posted some bugs and CRs in order to improve the
situation). But here's a new one:
DropArea has a 'onDropped' signal, that is supposed to be emitted "when a drop
event occurs within the bounds of a a DropArea." [1]. Great. In good faith,
I've added a DropArea to my Item, implemented DropArea.onDropped and presumed
that this handler would be called as soon as I drop something on it (using a
drag-enabled item).
Now, that's not the case:
DropArea.onEntered is called, but never DropArea.onDropped.
This is *very* confusing for the first time user.
[2] suggests adding something like this to the MouseArea initiating the drag:
onReleased: {
root.Drag.drop()
}
That will work, but it looks really more like a crude hack. Digging through
the source code, it seems that DropArea.onDropped is only called in case of
"external drop" events. The 'externaldraganddrop' example is also the only
user of that handler.
However, I believe we should try calling DropArea.onDropped in all cases --
without the work-around from above.
Makes sense? If yes, I'll try to prepare a patch which addresses this. Happy
to get any kind of feedback on this issue.
Greets
[1] http://qt-project.org/doc/qt-5/qml-qtquick-droparea.html#onDropped-signal
[2] https://groups.google.com/forum/#!topic/qt-mailing-lists-qt-qml/rXiwqyp5Qk8
--
Kevin Funk
More information about the Development
mailing list