Hi,
As the subject says.
I was not able to find any color role that changed the frame color of a QGroupBox, is it really impossible? (i.e do i really need to tweak QSytle for that?)
Thanks.
Printable View
Hi,
As the subject says.
I was not able to find any color role that changed the frame color of a QGroupBox, is it really impossible? (i.e do i really need to tweak QSytle for that?)
Thanks.
use QPalette. I think QPalette::Window should help or use BackgroundRole.
Strange, it does not work for me, not in code, and not in designer...
In your attached image I see you are working under windows... (I am under SUSE10)
Maybe its a window system issue?
I confirm that this code works on SuSE 10...try the following link
http://www.qtcentre.org/forum/showthread.php?t=2041
it's the same doubt that you posted!!!
This is in my code and it works
grpbox_right->setPalette(QPalette(Qt::darkBlue));
Nupul
Plastique style maybe? Then try:Quote:
Originally Posted by high_flyer
Code:
groupBox->setPalette(p);
QWindowsStyle lets QCommonStyle to draw PE_Frame primitive element. That's where I got the color group I advised to use. But anyway, it seems to depend on the used style. Such a pity, but for example QPlastiqueStyle seems to use a different color group for drawing frame rect...
You can check QxxxStyle::drawPrimitive()'s case PE_Frame for more information. :)
QPlastiqueStyle uses a merged color of darkened background palette color and highlight palette color or something like that..
I just found out that this code works where the other code snippets you suggested didn't work for me:
In all the code you supplied the group box was not parented, or its parent was not visible in the code supplied... I think it plays a role in this behaviour.Code:
//grpControls is a QGroupBox which is parented to another widget
Another thing that bothers me is when I try to set the frame color with designer no color role changes the frame color...
Can you confirm this?
Thanks for your help!
@jpn
Yes, your last reply was the right answer!
Its the Plastique, and when I try this with another stlyle its behaves as expected.
Tanks!