Frame color/palette of QGroupBox?
-
wrote on 16 Jan 2023, 09:11 last edited by CJha
Hi, I am trying to figure out the border color of
QGroupBox
. I have applied a fusion style and black palette toQApplication
and myQGroupBox
looks like this:
As you can see the border color ofQGroupBox
is neither black nor white but a shade of gray. I am trying to figure out which color is this.I have subclassed
QProxyStyle
and in itsdrawPrimitive()
function when the primitive element is equal toQStyle::PE_FrameGroupBox
I am printing all the colors that are available in its current palette in all its states (Active, inactive, and Disabled) but none of the colors seem to be the border color of theQGroupBox
.I tried to figure out the
QGroupBox
border color using the color picker fromQColorDialog
, here are the results for different palettes:- qApp->setPalette(QPalette{QColor{0,0,0}}) => QColor(ARGB 1, 0.0901961, 0.0901961, 0.0901961)
- qApp->setPalette(QPalette{QColor{10,10,10}}) => QColor(ARGB 1, 0.121569, 0.121569, 0.121569)
- qApp->setPalette(QPalette{QColor{20,20,20}}) => QColor(ARGB 1, 0.152941, 0.152941, 0.152941)
As you can see the border color does change with the change in the main color of the palette applied, how is this calculated and how can I get this programmatically from Qt?
-
Fusion style ignores palette for the groupbox frame and uses a hardcoded semi-transparent pixmap.
See the source.
-
Fusion style ignores palette for the groupbox frame and uses a hardcoded semi-transparent pixmap.
See the source.
wrote 14 days ago last edited by@Chris-Kawa, that's horrible. Do you have any idea whether that's deliberate? That seems worth filing a bug about.
-
@Chris-Kawa, that's horrible. Do you have any idea whether that's deliberate? That seems worth filing a bug about.
@RokeJulianLockhart said in Frame color/palette of QGroupBox?:
That seems worth filing a bug about.
A style can do whatever it likes. Here it was decided to paint them through a semi-transparent png. It's maybe not nice but...
if you come up with an equivalent solution which does exactly the same with some palette stuff - feel free to post a patch.