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?

СhiliРepper
  • 125
  • 1
  • 6

1 Answers1

18

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

ui->pushButton_1->setIcon(QIcon());
vahancho
  • 20,808
  • 3
  • 47
  • 55