I have a two state QPushButton. I want to associate an icon to each state.
It is like Play|Pause buttons in music players.
To do so, I would like to get the current icon name in order to know what the next icon to set will be.
I could subclass QPushButton but is it worth it?
Use QPushButton::icon() and QIcon::name() to get the icon name.
Instead of setting an icon based on the
QPushButton
's state, set oneQIcon
that has two states, Qt will select the correct icon if you use it with a checkableQPushButton
.