How do I change the colour of the text of a CheckBox?
Sorry for annoying again, but I've tried all things I have found, and neither of them seemed to work.
I need to match some colours to some checkboxes. I have read that stylesheets don't work here, HTML formatting neither, and the only other solution was modifying the palette. I have tried to do it inQtDesigner, and it worked, but I can't find a way to do it dynamically.
My code (doesn't crash, does nothing):
@ QPalette palette = (*lines[i]).palette();
palette.setColor(QPalette::WindowText,generateColour(i)); //Generates a valid colour
Can you help me, please?
You should use stylesheet. Parts of QPalette will be ignored by some modern style such as XP/Vista/MacOS
I'm not using newer Windows or Mac, I am using Linux, but it seems that the palette is ignored anyway. I'll try that stylesheet, I hope that I was wrong when reading that it can't be used.
maybe you use the wrong palette role. Did you try QPalette::ButtonText or QPalette::Text?
I can't remember which roles assign which color and i never will i think ... :)
I could only change the background colour, though, changing the text colour or anything else didn't seem to work (just did nothing). I think that linux's window manager is to blame.
I had tried also the palette roles you suggested, but neither of them had any effect. Style sheet was the only thing capable of colouring something on these checkboxes.
Thanks for the help. Is there a way to give you a kudos?