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

"strange" behaviour when using QRadioButtons

XMLWordPrintable

      The following example demonstrates strange behavior with autoExclusivity.

      #include <QApplication>
      #include <QWidget>
      #include <QVBoxLayout>
      #include <QFrame>
      #include <QRadioButton>

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      QWidget w;
      QVBoxLayout *l = new QVBoxLayout(&w);
      QFrame *frame = new QFrame(&w);
      frame->setFrameStyle(QFrame::Raised);
      l->addWidget(frame);
      QVBoxLayout *frameLayout = new QVBoxLayout(frame);
      frameLayout->addWidget(new QRadioButton("&1", frame));
      frameLayout->addWidget(new QRadioButton("&2", frame));
      l->addWidget(new QRadioButton("&3", &w));
      l->addWidget(new QRadioButton("&4", &w));
      w.show();
      return a.exec();
      }

      To reproduce:

      first issue:
      run app
      click 3
      click 4 (notice that 3 gets unchecked)
      click 1 (notice that 4 remains checked. This is expected)
      click 2 (notice that 4 remains checked and 1 gets unchecked. This is expected)
      click 3 (notice that 4 remains checked. This is not expected)

      second issue:
      comment out button 2

      run app
      click 1
      click 2 (notice that 1 gets unchecked. This is a little unexpected)
      click 3 (notice that 2 gets unchecked. This is expected)
      click 2 (notice that 3 gets unchecked. This is expected)
      click 1 (notice 2 remains checked. This is unexpected)

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

            bjnilsen Bjørn Erik Nilsen
            rve Anders Bakken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes