Pair label buddy to button group



  • Is this possible? I have paired all the rest of the labels on my UI with a specific object but there is one label that should be paired with a group because their are two radio buttons that represent options for the label.


  • Moderators

    @primem0ver
    Why, just why?
    First, QButtonGroup is not a QWidget.
    Second, what is the sense of this at all? I mean a label transfers the focus on shortcut activation to it's buddy. So where would it be transfered in the case of a group? If you expect it to be the first button, then set the first button as a buddy. Simple as that.



  • I agree with @raven-worx - set one of the buttons in the group as a buddy, user can then easily make change with keyboard arrows.



  • @raven-worx said in Pair label buddy to button group:

    Why, just why?

    Maybe because I am rather new to Qt Designer and its features. In the past i have done most of my layouts etc using code and I am trying to familiarize myself with the Designer's features and how they work. Is that ok with you?


  • Moderators

    @primem0ver said in Pair label buddy to button group:

    Is that ok with you?

    for me yes, of course.
    I just assumed when you are using a feature, that you checked what it is actually doing.
    I neither do want to be offending nor be rude, but the docs say it clearly what it does and why it doesn't make sense.



  • @primem0ver Ok, so when you look into QLabel docs you can see that buddy has to be QWidget or descendant where QButtonGroup inherits QObject.



  • @raven-worx
    That is fine. However, in general when I approach something new I don't make any assumptions about how it is supposed to work. I can only rely on experience that I have had with other tools.

    I was using the Qt Designer help to figure out how it works. It does mention that it connects labels to Widgets. However I tried creating a group-box widget and I couldn't link the label to it. Hence the question.

    Your solution works from a practical perspective, especially since the second option will not always be available but I like to work from a "conceptual" perspective when designing things (if that makes sense).


  • Moderators

    @primem0ver said in Pair label buddy to button group:

    However I tried creating a group-box widget and I couldn't link the label to it. Hence the question.

    The first question and the topic title refers to a button group (QButtonGroup), not a QGroupBox.



  • Correct. The button group was the next possibility that occurred to me. Perhaps I could have checked to see if it was a Widget first. I probably should have worded the question differently since I wasn't specifically interested in the class itself, simply the set of buttons that I wanted to group together.


Log in to reply
 

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