Writing QGraphicsItemGroup to a .png file?
-
Maybe something like that :)
@
QImage img(item->boundingRect().size().toSize(), QImage::Format_RGB32);
img.fill(QColor(255, 255, 255).rgb());
QPainter painter(&img;);
QStyleOptionGraphicsItem styleOption;
item->paint(&painter;, &styleOption;);
img.save(path);
@where "item" is your QGraphicsItemGroup.
P.S. I'm not sure, but you can try..
-
[quote author="kibsoft" date="1311145041"]Maybe something like that :)
@
QImage img(item->boundingRect().size().toSize(), QImage::Format_RGB32);
img.fill(QColor(255, 255, 255).rgb());
QPainter painter(&img;);
QStyleOptionGraphicsItem styleOption;
item->paint(&painter;, &styleOption;);
img.save(path);
@where "item" is your QGraphicsItemGroup.
P.S. I'm not sure, but you can try..[/quote]
I tried doing that, but it doesn't work; it only returns a blank image that's the same dimension of the QGraphicsItemGroup.