Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Qicon disabled full color
QtWS25 Last Chance

[SOLVED] Qicon disabled full color

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 9.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    evergreen
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • E Offline
        E Offline
        evergreen
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          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);
          @

          1 Reply Last reply
          0
          • E Offline
            E Offline
            evergreen
            wrote on last edited by
            #5

            @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...!

            1 Reply Last reply
            0
            • L Offline
              L Offline
              loladiro
              wrote on last edited by
              #6

              Try
              @
              QTableWidgetItem *name = new QTableWidgetItem("test");
              QIcon icon("toto.png");
              icon.addPixmap(QPixmap("toto.png"),QIcon::Disabled);
              name->setIcon(icon);
              @

              1 Reply Last reply
              0
              • E Offline
                E Offline
                evergreen
                wrote on last edited by
                #7

                Yep!

                That worked well!

                Thanks!

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved