Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using radiobutton for checkable QGroupBox?

Using radiobutton for checkable QGroupBox?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 6.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gongzhitaao
    wrote on last edited by
    #1

    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... )

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mtarini
        wrote on last edited by
        #3

        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,

        like:

        @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!

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goblincoding
          wrote on last edited by
          #4

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

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

          [/quote]

          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 :)

          http://www.goblincoding.com

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            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).

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved