Question

Look thoroughly at the disabled QGroupBox title (see attached image).

disabled QGroupBox

You'll notice a tiny white 1-pixel shadow under the title's letters.

It's barely noticeable on default style sheet, but it can be much more annoying if you set dark background and text color.

What can I do to disable this shadow, or at least change its color?

Was it helpful?

Solution

What style are you using? It looks like the 'basic' Windows style. If you want to get rid of the text shadow, you can implement your own style and change the way the text is drawn for disabled group boxes. Read more about about QStyle and how to create a custom style here. The link is for Qt 5.1, but the principle is the same for Qt 4 as well.

An easier way would be to simply change the palette for the QGroupBox object. Change the color identified by color group QPalette::Disabled and color role QPalette::Light to any color with the alpha channel set to 0, e.g. QColor(0, 0, 0, 0). This will effectively disable the text shadow. However, it will also disable the shadow of the lines so it might not be what you want.

OTHER TIPS

I've found a solution:

Unfortunately, you can't remove disabled text shadow (aka etching), but you can change its color using dirty workaround:

It looks like shadow effect always takes its color from the ColorGroup "Disabled" and the ColorRole "Light" of the current palette. So, you just set this color to the background color of your widget:

QPalette p = myWidget->palette();
p.setColor(QPalette::Disabled, QPalette::Light, QColor(0,0,0)); <- place your widget bg color here
myWidget->setPalette(p);

I've found this solution here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top