PDA

View Full Version : how to reshape pushbutton??



anupamgee
23rd April 2009, 14:06
hi all,
i want to reshape the qpushbutton according to the shape of image.
i used setIcon(qicon &) to set the image on pushbutton but it is setting the icon on a rectangular pushbutton.But i want the shape of pushbutton as of the image...
How to do it??

spirit
23rd April 2009, 14:19
have a look at QWidget::setMask.

anupamgee
24th April 2009, 13:37
thnx for reply..
i tried setmask(),but still after using this,i got a black boundary of pushbutton ,when i pressed the qpushbutton....
i write the following code:


MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
QPushButton *button_close=new QPushButton(this);
QPixmap image(":/images/but_00.png");
button_close->setGeometry(100,100,image.width(),image.height());
button_close->setFlat(1);
QSize size(image.width(),image.height());
button_close->setIconSize ( size );
button_close->setIcon(image);
button_close->setMask(image.mask());
}

Is something wrong in code??
or Is there any other way to do this??
plzz specify..