Hello.
I create two QPixmaps: one is loaded from a bitmap file, the other one is drawn. The first one can be rescaled with scaled(), the second one can not. Do you know why? Thank you!
This scaling works
pm.load("image.jpg");
pm = pm.scaled(300,225); //this works fine
pixmapLabel->setPixmap(pm);
QPixmap pm(600,450);
pm.load("image.jpg");
pm = pm.scaled(300,225); //this works fine
pixmapLabel->setPixmap(pm);
To copy to clipboard, switch view to plain text mode
This scaling won't work:
p.setPen(pen);
p.drawLine(0, 0, 600, 450);
pm = pm.scaled(300,225);//this has no effect. why?
pixmapLabel->setPixmap(pm);
QPixmap pm(600,450);
QPainter p(&pm);
QPen pen(Qt::red, 2);
p.setPen(pen);
p.drawLine(0, 0, 600, 450);
pm = pm.scaled(300,225);//this has no effect. why?
pixmapLabel->setPixmap(pm);
To copy to clipboard, switch view to plain text mode
Bookmarks