Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED] Qicon disabled full color

    General and Desktop
    2
    7
    8895
    Loading More Posts
    • 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
      evergreen last edited by

      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 Reply Quote 0
      • L
        loladiro last edited by

        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 Reply Quote 0
        • E
          evergreen last edited by

          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 Reply Quote 0
          • L
            loladiro last edited by

            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 Reply Quote 0
            • E
              evergreen last edited by

              @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 Reply Quote 0
              • L
                loladiro last edited by

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

                1 Reply Last reply Reply Quote 0
                • E
                  evergreen last edited by

                  Yep!

                  That worked well!

                  Thanks!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post