Hi,
I have several widgets in a graphics scene. I want to take a image copy of 1 of the widgets.
I attempted the following:
screenshot
= QPixmap::grabWidget(theWidget,theWidget.
rect());
screenshot.save("test.png","PNG");
QPixmap screenshot;
screenshot = QPixmap::grabWidget(theWidget,theWidget.rect());
screenshot.save("test.png","PNG");
To copy to clipboard, switch view to plain text mode
THis will save the widget but the widget is stripped of EVERYHTING. Basically you don't see the background image on the widget, you don't see any alpha settings I set, you simply see an outline of the widget and some text.
I also tried:
TheGraphicsView->render(&painter);
image.save("test.png","PNG");
QImage image(300,300,QImage::Format_RGB32);
QPainter painter(&image);
TheGraphicsView->render(&painter);
image.save("test.png","PNG");
To copy to clipboard, switch view to plain text mode
This will give me the exact same result as above.
Lastly I tried:
screenshot = QPixmap::grabWindow(QApplication::desktop()->winId());
To copy to clipboard, switch view to plain text mode
This will capture the whole screen which is not what I wanted. This will though show everyhting fully rendered.
Any ideas how I can capture just 1 WIDGET in the graphics view fully rendered?
Thanks
Bookmarks