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

QRadioButton::setChecked(false) does not work with autoExclusive mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.7
    • None
    • Windows

      When trying to programmatically uncheck one of multiple QRadioButtons in a QButtonGroup or in autoExclusive mode, it doesn't work.

      Temporarily disabling autoExclusive mode on the radio button in question is a workaround.

      However, I feel that there should be no reason for QRadioButton::setChecked(false) not to work. All buttons being unchecked must be a valid state as it can (and often will) also be the initial state of a group of radio buttons, even if they are in a QButtonGroup or autoExclusive mode is enabled, and also because it can be reached via the workaround above anyway.

      If, on the other hand, there is a good reason for this behaviour, then I think that reason and the behaviour itself should be pointed out and explained in the documentation, where there is currently no mention of this issue, as setChecked is inherited from QAbstractButton.

      Attached is a minimal working example.

        1. main.cpp
          0.2 kB
          Simon Vetter
        2. mainwindow.h
          1 kB
          Simon Vetter
        3. qt_bug_setchecked.pro
          0.5 kB
          Simon Vetter
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            svetter Simon Vetter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes