How to remove icon from QPushButton?

After starting the program, I install icons on all buttons. The code is as follows:

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

But after some action I need to delete the photos and set the text. How can i do this?

+4
source share
1 answer

To delete an image, you can set an empty image instead of an existing one. For instance:

ui->pushButton_1->setIcon(QIcon());
+9
source

All Articles