QPixmap.transformed(QTransform::fromTranslate(x,y) ) did not have a good result.
Is there a way?
QPixmap.transformed(QTransform::fromTranslate(x,y) ) did not have a good result.
Is there a way?
Jerry
Have you tried QPixmap::scaled(), QPixmap::scaledToWidth() and QPixmap::scaledToHeight() ?
Where do you want to put the larger QPixmap? On a QLabel? Then just have a look at QLabel::scaledContents()
yes,i tried the scaled(), but it did not work as I wanted. It just scaled the whole picture. what i wanted is just larger the paint area and leave the origin picture unchanged.Then I will draw something on the blank area.
Added after 32 minutes:
Is it a complicated problem?
Last edited by calmspeaker; 8th July 2011 at 07:19.
Jerry
Well if you just want to adjust the size of the paint area it is not very complicated. Lets say that you are painting in a QWidget then in paintEvent() you can do something like this.
Qt Code:
QPixmap example; example.load("Picturepath"); this->resize(pixmapSize);To copy to clipboard, switch view to plain text mode
Edit: And of course use QPainter::drawPixmap after that
Last edited by meazza; 8th July 2011 at 07:33.
Use QPainter inside paint event and draw pixmap through
void QPainter::drawPixmap ( int x, int y, int width, int height, const QPixmap & pixmap )
I hope it will help you...
calmspeaker (8th July 2011)
You did help meï¼ Thank you.
Qt Code:
pix.fill(Qt::transparent); paint.drawPixmap(16,16,16,16,pixicon);//bottom right paint pixicon To copy to clipboard, switch view to plain text mode
Jerry
Bookmarks