I want to set the size of pixmap. The code is defined below.
It is showing a bigger image.
How to set the size?
Printable View
I want to set the size of pixmap. The code is defined below.
It is showing a bigger image.
How to set the size?
You can either
1) Scale the pixmap befor drawing it, or
2) Use a version of drawPixmap that will do the scaling:
void QPainter::drawPixmap ( const QRectF & target, const QPixmap & pixmap, const QRectF & source )
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
Note: The pixmap is scaled to fit the rectangle, if both the pixmap and rectangle size disagree.
this one works, the one i am showing below--------->
Code:
int x=points->x(); int y=points->y(); painter->drawpixmap(x,y,width,height,pixmap);//here replace the width and height with the pixmap width and height that you want to resize.
And then you will get the image with the size that you've configured.