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. I am creating a hyper link text through Qlabel but i am not able to change its color through Qpalette class?
Forum Updated to NodeBB v4.3 + New Features

I am creating a hyper link text through Qlabel but i am not able to change its color through Qpalette class?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.5k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    pratik041
    wrote on last edited by
    #1

    I am able to change its color through stylesheet but why setting the color with QPalette is not working.
    I have tried this
    @
    QPalette pal(label->palette ());

    pal.setColor (QPalette::Text, QColor(255,255,0));

    label->setPalette (pal);
    @

    Pratik Agrawal

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Did you read this warning in the [[doc:QPalette]] documentation?
      [quote]Warning: Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for both the Windows XP, Windows Vista, and the Mac OS X styles.[/quote]

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pratik041
        wrote on last edited by
        #3

        So what should we use in place of QPalette for the same purpose.

        Pratik Agrawal

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          [quote author="pratik041" date="1324378815"]So what should we use in place of QPalette for the same purpose.[/quote]

          [quote author="pratik041" date="1324375284"]I am able to change its color through stylesheet (...)[/quote]

          Seems to me you already answered your own question.

          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