Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we delete icon from QPushButton?

After begining the program I set icons on all pushbuttons. Code is like this:

QImage img;
img.load(pictureName);    
ui->pushButton_1->setIcon(QPixmap::fromImage(img));
ui->pushButton_1->setIconSize(img.size());

But after some actions I need delete pictures and set some text. How can I do it?

like image 322
СhiliРepper Avatar asked Nov 24 '14 15:11

СhiliРepper


1 Answers

In order to delete an image you can set an empty image instead of existing one. For example:

ui->pushButton_1->setIcon(QIcon());
like image 74
vahancho Avatar answered Oct 02 '22 01:10

vahancho