Important: Please read the Qt Code of Conduct -

[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?


  • It's possible with "QPalette":
    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?


  • 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;

  • @QTableWidgetItem *name = new QTableWidgetItem("test");
    QIcon icon("toto.png");

    I tried this but it doesn't work...!

  • Try
    QTableWidgetItem *name = new QTableWidgetItem("test");
    QIcon icon("toto.png");

  • Yep!

    That worked well!


Log in to reply