Resize width of QPixmap without scale
-
Hi,
Hello is it possible to resize a QPixmap without auto rescale of the height ?
I tryed many way but nothin seems to work.
If not i will have to load every single picture modified in paint or something like that...
Of course i spent time searching on the web but nobody asked this question already.
I'm pretty new in Qt Framework but i will learn as fast as possible.
Thanks in advance -
Hi and welcome to devnet,
Do you mean QPixmap::scaled using Qt::IgnoreAspectRatio ?
-
Ho yeah, thanks alot.
I did not check the scaled method, i was trying something like resize or setGeometry.
It work fine !Here is how look my slot now:
void MainWindow::resizeRessort(int resizeWidth) { int newWidth=(int)(((resizeWidth+1)/100.0)*myWidth); QSize myRessortSize(newWidth,myHeigth); QPixmap myNewRessort =myRessort->scaled(myRessortSize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation); myLabel->setPixmap(myNewRessort); }
Hope it can help
Thanks
-
You're welcome !
Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)