How can we delete icon from QPushButton?

8.2k views Asked by At

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?

1

There are 1 answers

0
vahancho On BEST ANSWER

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

ui->pushButton_1->setIcon(QIcon());