How can we delete icon from QPushButton?
Asked Answered
S

1

9

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?

Shekinah answered 24/11, 2014 at 15:19 Comment(0)
C
19

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

ui->pushButton_1->setIcon(QIcon());
Colloidal answered 24/11, 2014 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.