QGraphicsItem screenshot
-
I just gone out of this :)
Here the code I used:
@
QImage image(item->boundingRect().size().toSize(), QImage::Format_RGB32);
image.fill(QColor(0, 0, 0).rgb());
QPainter painter(&image);
QStyleOptionGraphicsItem styleOption;
qobject_cast<QGraphicsObject*>(item)->paint(&painter, &styleOption);
painter.end();@here my "item" is a QDeclarativeitem, but its inerithed by QGraphicsItem, so souldn't be any problem I think.
-
bq. I wonder if item transformations can screw up the painting.
whit that code the image grabbed will be the item without transformations. But if you inscribe your item into another, you can then grab the outer one with the inner rotated :)
bq. @deimos: your mediadownloader is a nice piece of software !
Are you playing the videos natively using FFMPEG and QPixmap(s) ?thanks a lot. Compliments are always welcome and I didn't received a lot even if it is been downloaded a lot :)
Video are played with phonon (I am rewriting it using QtMultimediaKit without phonon) and since youtube needs cookies and with phonon you have not direct access to network (you can't set QNetworkRequest) I have subclassed QIODevice to threat streaming videos as a local file. They can be played also with mplayer. FFMPEG is used only to convert them.sorry to all for this OT
@bunjee: if you want to find me I am in #qt, #meego channels at freenode irc :)