You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, July 13th 2009, 6:25pm

Change button Icon on toggle

Hello, all;

I'm trying to program a QPushButton or QToolButton to change the icon being displayed when toggled/activated. Unfortunately, I'm on a shard system and unable to use QSetIcon or add it to the library. Any suggestions on how to proceed?

Thanks in advance,

Allan

2

Tuesday, July 14th 2009, 2:03am

There are some signals you can use and then set your icon in the slot when it gets activated:

QObject::connect(pToolButton, SIGNAL(pressed()), this, SLOT(ChangeIcon( )));

3

Tuesday, July 14th 2009, 2:03am

You can use "setStyleSheet".

4

Wednesday, July 15th 2009, 12:36am

Great, thanks for the input! I appreciate the assistance.