On Tue, Jan 28, 2014 at 1:25 PM, Mark Gaiser <[email protected]> wrote: > On Tue, Jan 28, 2014 at 8:28 PM, Alan Alpert <[email protected]> wrote: >> On Wed, Jan 22, 2014 at 10:42 AM, Mark Gaiser <[email protected]> wrote: >>> On Wed, Jan 22, 2014 at 12:11 AM, Fabien Castan <[email protected]> wrote: >>>> Hi, >>>> >>>> Qt 5.2 adds the possibility to use drag&drop from/to external applications. >>>> To allows to drag an item from QML to an external application, we can't >>>> simply set a target item, because we want to see this item ouside of the >>>> qml >>>> window. >>>> In Qt, we could set a pixmap on drag events: >>>> http://qt-project.org/doc/qt-4.8/qdrag.html#setPixmap >>>> >>>> I don't see something like that in QtQuick (Qt 5.2): >>>> http://qt-project.org/doc/qt-5/qml-qtquick-drag.html >>>> >>>> Is there a solution to do such thing in pure QML? >>>> >>>> Regards, >>>> Fabien >>> >>> While browsing through the code (qquickdrag.cpp) i found these two >>> commented lines: >>> // TODO: how to handle drag image? >>> // drag->setPixmap(iconPixmap); >>> >>> Along with that no more function for "setPixmap" that is exposed to QML. >>> That makes me fear that the setPixmap property is not there anymore. >>> >>> Odd, since it would be an API break which i can't really imagine from Qt. >>> >>> I hope someone else more knowledgeable in this area can chime in? >> >> Use of direct QPixmaps in QML is discouraged, because there's no real >> way to manage the memory of the pointer. If there were a QObject or >> QJSValue wrapper around QPixmap then a setPixmap could be added, >> similar to the setPixmap in QDrag (although not actually accepting a >> QPixmap type). >> >> So without a good solution handy, that part has been left "for later". > > Alan, would it be possible to use a Image{...} item as "pixmap"? > Yes, right now it's not possible, but just as an idea for a workable > implementation.
Not really. The Image element contains much more than just the pixmap, such as positioning and rendering hints, so it's both too heavy and most of the properties would be lost. We'd ideally like a lightweight JS wrapper which just takes a URL (possibly one from an image provider), so long as it can be used declaratively. -- Alan Alpert _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
