Hi,
I'm new to this list, so please re-direct me if I'm not at the right place.


I'm having problems with saving a qt3d window to image. #1, #2, #3 gives me
blank image. #3 not the right screenshot. When I show() plot3D or plotWidget
everything looks good (I get the correct drawing/plot).


Any comments/ideas more than appreciated ;-)


Cheers,
Miro


Here are my 4 approaches:
QGLView *plot3D = dynamic_cast<QGLView *>(mItemPtr.data());

plot3D->show();

//#1
QWidget *plotWidget = QWidget::createWindowContainer(plot3D);
plotWidget->show();
const QRect rect = plotWidget->grab().rect();
QPixmap pix1 = QPixmap::grabWidget(plotWidget);
pix1.save("img1.png");

//#2
QPixmap pix2 = plotWidget->grab();
pix2.save("img2.png");

//#3
QImage bitmap(rect.size(), QImage::Format_ARGB32);
QPainter painter(&bitmap);
plotWidget->render(&painter, QPoint(), QRegion(), QWidget::DrawChildren);
bitmap.save("img3.png");

//#4
QPixmap::grabWindow(plot3D->winId()).save("img4.png");


_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to