[Qt-qml] QML Component Snapshot / Cover-Flow (PathView) implementation suggestions
jevon.beckles at orange-ftgroup.com
jevon.beckles at orange-ftgroup.com
Thu Nov 18 10:10:10 CET 2010
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:gregory.schlomoff at gmail.com]
Sent: 18 November 2010 04:31
To: michael.brasser at nokia.com
Cc: BECKLES Jevon RD-ILAB-LON; qt-qml at trolltech.com
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
More information about the Qt-qml
mailing list