Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-90407

Toggling one single QRadioButton in a group

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.14.2
    • None

    Description

      Hello Qt developers,

       

      I have 3 `QRadioButton`'s inside a `QGroupBox`. I understand that they enable auto-exclusive by default.

       

      Now in code, I wish to be able to call a single line `setChecked(true)` of a button to check it. And I wish the other buttons to be automatically unchecked (similar to a user click.)

       

      To be able to do that from code, I must do these:

      • Call `setAutoExclusive(false)` on 3 of them.
      • Call `setChecked(false)` on 2 of them.
      • Call `setChecked(true)` on one of them.
      • Call `setAutoExclusive(true)` on 3 of them again.

      May I ask if you could make it easier?

      I wish to be able to call `setChecked(true)` on one of them, and the rest will be unchecked automatically. Just like a user click.

       

      Apparently, a user click does what I want. But a single call to `setChecked(true)` does nothing.

      It's very inefficient.

       

      Thank you for your time,

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            em2ceyhqfflon em2cEYhqFfLon protonmail
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes