Using radiobutton for checkable QGroupBox?

  • i want to put radiobutton as the title of checkable QGroupBox, how can i do it? I google it, someone says drawing it yourself><...
    is there a more easier and straightforward way to do this? can i do it using the stylesheet( dont know how at least for myself... )

  • I don't think there is an easy way. The only thing I can think of, is using a proxy style or, as you say, using style sheets and the ::indicator subcontrol.

    However, it seems like a weird UI at first sight. Perhaps you want to rethink your idea. Generally, radiobuttons should be put directly under each other, because otherwise it is very hard for a user to grasp the idea that it is an exclusive group of options. In your design, you automatically create a lot of space between the radio buttons, interspaced even with other widgets. That would, IMHO, be hard to use.

    If you have a set of exclusive choices, and each needs its own specific configuration, then perhaps you can considder a non-editable combo box with a QStackedWidget that presents a page of settings for each of the options in the combo box, or something along those lines.

  • Au contraire, my friend...

    Checkable, autoexclusive groupboxes looking like radiobuttons would be greatly useful.
    Really often, I find myself wishing I could use them.

    The resulting interface would be totally neat and clear,


    @Choose your meal:

    (x) Standard -----------

     ( ) Meatballs
     (x) Beef spaghetti
     [ ] Extra cheese cake

    ( ) Vegan --------------

     ( ) Broccoli
     ( ) Tomato macaroni
     ( ) Just grass
     [ ] Extra coffee


    The above makes it clear at a glance (at least, to me) what options you have, and the sub-options
    (yes the coffee is only available to vegans here).

    The top-level alternatives (here: Standard and Vegan) are visually linked not by proximity, but by the layout, which works just as well.

    That solution can be preferable to the suggested "combo-box with hidden widgets", because it revels it all without requiring the user to fiddle with the interface.

    (also, the "combo-box" could be misleading, e.g. here it could suggest that you can order something from the standard and something from the vegan menu in the same meal -- just as you would do if Standard and Vegan were two tabs in a multi-paged tabbed widget).

    Too bad it is so hacky to get that in QT!

  • [quote author="mtarini" date="1346971755"]

    Too bad it is so hacky to get that in QT!


    Are there any other SDK's that provide something like this standard?

    Also, just one minor correction, QT is "QuickTime", Qt is what you are looking for :)

  • Sorry, but that UI looks still weird to me. What happens if after I have selected what you have selected, I then change my mind and select Broccoli instead? The Meatballs are disabled, but still selected! That is just weird. Also, I stand by my claim that the radio buttons need to be close together in order to be usable. Interspacing them with different lists is really not a good idea.

    For your use case, i'd use a list with grouping headers in between and a radio button before each item (but not before each header).

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.