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
Qt Code:
  1. QPixmap pm(600,450);
  2. pm.load("image.jpg");
  3. pm = pm.scaled(300,225); //this works fine
  4. pixmapLabel->setPixmap(pm);
To copy to clipboard, switch view to plain text mode 

This scaling won't work:
Qt Code:
  1. QPixmap pm(600,450);
  2. QPainter p(&pm);
  3. QPen pen(Qt::red, 2);
  4. p.setPen(pen);
  5. p.drawLine(0, 0, 600, 450);
  6. pm = pm.scaled(300,225);//this has no effect. why?
  7. pixmapLabel->setPixmap(pm);
To copy to clipboard, switch view to plain text mode