PDA

View Full Version : disabled QCheckBox text stylesheet: how to get rid of / change color of etch effect



matthewg42
29th November 2010, 10:53
I'm making a very red and black style, but I can't seem to get rid of the non-red on the etch effect for disabled QCheckBox elements: http://i.imgur.com/pzDEE.png (last checkbox is disabled, and looks wrong).

The relevant parts of my stylesheet look like this: http://pastebin.ca/2005571

I found etch-disabled-text, and tried setting it to "0" and "0px" but it didn't help.

Using QT 4.7.0 on Ubuntu 10.10.

high_flyer
29th November 2010, 19:45
I found etch-disabled-text
Where did you 'find' it?
I can't find such a property in the documentation.
It makes also no sense, since its a mix of a sub control and a state, and these are sperated in the style sheet syntax.
You probably are looking for 'idicator' sub control.
http://doc.trolltech.com/4.7/stylesheet-reference.html#indicator-sub

matthewg42
2nd December 2010, 13:22
I found it using google, in the qtopia documentation. http://doc.qt.nokia.com/qtopia4.3/stylesheet-reference.html (search for "etch" within this page and you'll find a reference to it).

It is my understanding that the ::indicator is the actual check / unchecked graphic. I actually already use this to use a custom graphic and it works well. However, the problem is not the graphic. The problem is the disabled text style, which I cannot figure out how to change.

*edit* I can verify that the "QCheckBox::disabled" selects the correct component - if I change the "color" value I see the font color change as expected. The problem is that no matter the color setting, the font always has the disabled etched look with the etch being the wrong color.

Added after 1 51 minutes:

I made some progress. In the code I managed to change this color like this:

QPalette p = QApplication::palette();
p.setColor(QPalette::Disabled, QPalette::Light, QColor(255,0,0));
QApplication::setPalette(p);

So apparently that disabled text etch effect takes the color from for the role disabled, with the ColorGroup "Disabled" and the ColorRole "Light".

Now I just need to work out how to get the same effect from the stylesheet...

matthewg42
2nd December 2010, 13:24
Looks like I'm not the only one with this problem: http://lists.trolltech.com/pipermail/qt-interest/2010-August/026312.html

high_flyer
2nd December 2010, 14:57
since I can't find the etch property in the property list, not the documentation you linked to nor any other, I think this is either pseudo code or something else, probably this examples should not be there.

It might be that this issue (disabled text color shadow) is not stylable through style sheet, for what ever reason.
If this is the case, you are stuck with QPalette.