December 20, 2011

pratik041 pratik041
Lab Rat
346 posts

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

 

I am able to change its color through stylesheet but why setting the color with QPalette is not working.
I have tried this

  1. QPalette pal(label->palette ());
  2.  
  3. pal.setColor (QPalette::Text, QColor(255,255,0));
  4.  
  5. label->setPalette (pal);

 Signature 

Pratik Agrawal

3 replies

December 20, 2011

Andre Andre
Area 51 Engineer
6031 posts

Did you read this warning in the QPalette documentation?

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.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

December 20, 2011

pratik041 pratik041
Lab Rat
346 posts

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

 Signature 

Pratik Agrawal

December 20, 2011

Andre Andre
Area 51 Engineer
6031 posts
pratik041 wrote:
So what should we use in place of QPalette for the same purpose.
pratik041 wrote:
I am able to change its color through stylesheet (…)

Seems to me you already answered your own question.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

 
  ‹‹ [SOLVED]Checked and disabled      [solved] Filtering model in a locale-aware way ››

You must log in to post a reply. Not a member yet? Register here!