grabwidget image capturing problem
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.
Re: grabwidget image capturing problem
Hi,
You can also render your Scene to a pixmap and save it. See for example:
Code:
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
scene.render(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.
Carlos
Re: grabwidget image capturing problem
Thanks i tried with render and it worked .