How to change the icon of the actions on ToolBar during runtime?
I want to design an action, like the control buttons of a media player, when I click the start button, the button becomes a pause button.
I have set the default action icon, when I try to change it, use codes following:
I found the icon will become empty.
So what's the right method? :(
That should do it. Are you sure the path is correct?
@sheeley The icon file must be JPG or PNG
@Chris-Kawa Yes yes you're right i misspoke. what i meant was that it would work with another format by giving two widely-used formats. But indeed it would work with the formats given in the link
@Chris-Kawa Thanks for your reply.
The folder tree is as follows:
.....others cpp files
.....resources <- This is a folder.
The codes above are in the mainWindpw.cpp, so was the path right?
Did you put disconnect.ico in Qt's resource system ? Otherwise that's the first problem you have with the path you used in you sample code.
@SGaist Thank you.
I mistook the resources prefix. It works now.