[SOLVED] Qicon disabled full color
-
Hello,
I'm currently using a QTableWidget with some QIcons in the QTableWidgetItem. Some of them are disabled, some of them are not.
When they are disabled, Qt automatically colors them in grey. I want to disabled this grey color for disabled icon for aesthetic issues.
The icons would all look alike.I can't find a way to do it. Someone know?
Thanks
-
It's possible with "QPalette":http://doc.qt.nokia.com/4.7/qpalette.htm
You'll have to adjust the colors in the disabled group to be the same as in the active color group -
I never used QPalette before, I really have no idea how to do what you say.
Could give me an example of its use?Thanks
-
Sorry, I might have lead you on the wrong track here. The above method works with widgets, but not icons. What you could do though is something like this:
@
QIcon icon;
icon.addPixmap(pixmap,QIcon::Active);
icon.addPixmap(pixmap,QIcon::Disabled);
@ -
@QTableWidgetItem *name = new QTableWidgetItem("test");
QIcon icon("toto.png");
name->setIcon(icon);
icon.addPixmap(QPixmap("toto.png"),QIcon::Disabled);@I tried this but it doesn't work...!
-
Try
@
QTableWidgetItem *name = new QTableWidgetItem("test");
QIcon icon("toto.png");
icon.addPixmap(QPixmap("toto.png"),QIcon::Disabled);
name->setIcon(icon);
@ -
Yep!
That worked well!
Thanks!
1/7