Hey Gregory,

This is the kind of snapshot thing that I was looking for. Thanks, this
could prove very useful.

Regards,
Jevon

-----Original Message-----
From: Gregory Schlomoff [mailto:[email protected]] 
Sent: 18 November 2010 04:31
To: [email protected]
Cc: BECKLES Jevon RD-ILAB-LON; [email protected]
Subject: Re: [Qt-qml] QML Component Snapshot / Cover-Flow (PathView)
implementation suggestions

> There's no built-in QML-based way to take snapshots -- you'd need a
custom
> C++ component to do something like this (it does seem to be a frequent
> request; has anyone else made a component for this already?).

Yes, we did that in our custom drag&drop component.

Here's the relevant snippet from
http://bitbucket.org/gregschlom/qml-drag-drop/src/e5dbe26c3073/Declarati
veDragArea.cpp

==========
QDeclarativeItem* item // This is the item whose snapshot you want to
take

QGraphicsScene scene;
scene.addItem(item);

QPixmap pixmap(scene.sceneRect().width(), scene.sceneRect().height());
pixmap.fill(Qt::transparent);

QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
scene.render(&painter);

// And now, enjoy your pixmap with the freshly painted item
=========

Cheers,

greg

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to