Probably you want to use QIcon class . You can find example how to use it with QPushButton in Assistant.
If you want to toggle the icon, you should connect signal clicked() or toggled() of your button to your custom slot and in that slot just call QPushButton::setIcon() method.
Again, read about QPushButton and QIcon in Assistant.
If your button is checkable you can also do it without signal and slot. Here's an example:
b->setIcon(*ico);
b->setCheckable(true);
QToolButton *b = new QToolButton(this);
QIcon *ico = new QIcon();
ico->addPixmap(QPixmap("on.jpg"),QIcon::Normal,QIcon::On);
ico->addPixmap(QPixmap("off.jpg"),QIcon::Normal,QIcon::Off);
b->setIcon(*ico);
b->setCheckable(true);
To copy to clipboard, switch view to plain text mode
Unfortunately, I'm on a shard system and unable to use QSetIcon or add it to the library
I really don't understand what do you mean. Could you elaborate?
Bookmarks