Domanda

I would to have a QPixmap with the size 50 x 50. I tried :

QPixmap watermark(QSize(50,50)); 
watermark.load(":/icoMenu/preparation");

but the QPixmap take the image size.

I tried also :

QPixmap watermark(":/icoMenu/preparation");
watermark.scaled(QSize(50,50),  Qt::KeepAspectRatio);

but same result.

È stato utile?

Soluzione

You almost made it

QPixmap watermark(":/icoMenu/preparation");

QPixmap newPixmap = watermark.scaled(QSize(50,50),  Qt::KeepAspectRatio);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top