[Interest] QGroupBox Subclass

Tony Rietwyk tony at rightsoft.com.au
Tue May 21 17:29:05 CEST 2013

> Sent: Tuesday, 21 May 2013 11:32 PM
> I am currently using a QGroupBox (with some custom style sheets) as a
> superclass for a custom widget in our program. QGroupBox has the
> "isCheckable" property which we use then style with a custom image for an
> icon and over ride the "toggled" to get some custom actions when the user
> clicks the "button". We would like to be able to add a few more buttons to
> the QGroupBox to perform some other actions. I took at the source code for
> QGroupBox to try and figure out where the layout was being performed and
> I would have to say I understand generally what is going on but I can not
> figure out where the actual "QCheckBox" is being added to the layout for
> QGroupBox.
>   My Question is: Could some nice developer just give me a nudge in the
> direction as to where the actual layout of the QGroupBox is being
> and where the QCheckBox is instantiated? I think I can figure it out from
> there.
> Thanks so much.
> ----
> Mike Jackson (dream3d.bluequartz.net)

Hi Mike, 

There is no QCheckBox child.  The checkbox is drawn and handled in
conjunction with the style as a QStyle::SubControl.  See QGroupBox.event for
the details (around line 330 in 4.8.4).   I think you need to override
QProxyStyle to force extra space between the existing checkbox and label.  

Please let the list know how you go, as I may need to do something similar



More information about the Interest mailing list