PDA

View Full Version : setIcon() - different QIcon states?



AaronMK
28th January 2008, 19:30
How do I actually access the different states of a QIcon, and use them in the setIcon() functions of various Qt objects?

Supposedly, the QIcon class automatically generates different versions, such as a grayscale version for a disabled state. It seems the only way to access them is to generate a specific W x H pixmap of it, or to change the state of an entire Data Model item.

Is there something that might be the equivalent of setIcon(const QIcon &icon, QIcon::Mode mode) for many Qt objects?

Thanks!

seveninches
29th January 2008, 04:10
How do I actually access the different states of a QIcon, and use them in the setIcon() functions of various Qt objects?
Supposedly, the QIcon class automatically generates different versions, such as a grayscale version for a disabled state. It seems the only way to access them is to generate a specific W x H pixmap of it, or to change the state of an entire Data Model item.


If you need to access the image of generated QIcon, you could use QIcon::pixmap with needed Mode to access any state. Then you could construct a new QIcon from it, and use it.