Resize image to fill a QPushButton ?
Hi! I'm newbie in Qt mobile! I have a problem when i load an image into a QPushButton. I loaded it! But the size of image is larger than the size of button! I want to reduce the size of image to fill the button! This is my code :
Code:
// Set image for button
QPixmap *image
= new QPixmap("C:\\Symbian\\Project\\Images\\mypic.png");
QSize iconSize
(image
->width
(), image
->height
());
ui->button->setIcon(icon);
ui->button->setIconSize(iconSize);
Help me ! Thanks a lot!
Re: Resize image to fill a QPushButton ?
Use QPushButton::setIcon and QPushButton::setIconSize directly without anything else. Qt will scale the image for you!
Code:
ui
->button
->setIcon
(QIcon("C:\\Symbian\\Project\\Images\\mypic.png"));
ui
->button
->setIconSize
(QSize(22,
22));
Re: Resize image to fill a QPushButton ?
Thanks a lot! By the way, I want to create a dialog with some buttons and vertical layout and i used QScrollarea ! I drag and drop it in my dialog! Why didn't the scrollarea run ? I'm programming it for Nokia E71. (i'm not good at English! Sorry :D)
Re: Resize image to fill a QPushButton ?
is anyone taking this mobile image resize program?and can anyone suggest me some better image rotate and resize software that i can download and install on my mobile? thx.
Re: Resize image to fill a QPushButton ?
Are you looking for the image resizing program? Have you found your way out? I am testing with the related Imaging SDKs these days. I want to find some manual tools which can be customized by users according to their own favors. Do you have any good suggestion? Thanks in advance.
Best regards,
Arron
Re: Resize image to fill a QPushButton ?
It's a great pleasure to visit your website and to enjoy your excellent work. You have fime ideas. Really looking forward to read more.