[Development] QtQuick: Drag pixmap

Olivier Goffart olivier at woboq.com
Wed Jan 29 09:54:33 CET 2014


On Tuesday 28 January 2014 11:28:42 Alan Alpert wrote:
> On Wed, Jan 22, 2014 at 10:42 AM, Mark Gaiser <markg85 at gmail.com> wrote:

> > 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".

I don't quite understand the problem.  QPixmap manage its own memory.  And you 
can use it in a QVariant for example, which can already be handled by QML.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org




More information about the Development mailing list