View Full Version : grabwidget image capturing problem

10th August 2011, 12:27
I am trying to capture the image of a QGraphicsView . I have used grabwidget to capture this image . I have written a small program and i successfully captured the image . But the problem is when i tried to integrate it with my product the image captured is not clear (dark lines and spots on the image ). Can anyone give me any siggestion on this.

10th August 2011, 14:53

You can also render your Scene to a pixmap and save it. See for example:

QImage *image = new QImage(103,103,QImage::Format_RGB32); //Creates an image of a size 103x103 //Change for the size of your scene
QRgb value;
value = qRgb(255, 255, 255);
image->fill(value); //Fill the image with white
QPainter *painter = new QPainter(image); //Create a new painter based on the image

//Renders the scene to the painter

image.save("/home/cquiros/tnkicono.jpg","JPG"); //Saves the image

Depending on the file format, you will lose some image quality.

Hope it helps.


16th August 2011, 06:39
Thanks i tried with render and it worked .