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

QButtonGroup does not force only one toggle button

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P2: Important P2: Important
    • 4.6.0
    • 4.3.5
    • None

      It is possible within an exclusive QButtonGroup managed list of buttons to end up with multiple buttons appearing in the toggled state. By rapidly clicking buttons on the widgets in an adhoc manner, the user occasionally ends up with more than one button appearing in the toggled
      state. This has been verified a couple of times in Qt 4.3 and 4.4.0, and only when using the CDE style.

      Test case main.cpp to reproduce:
      --------------------------------------
      #include <QtGui>

      class Buttons : public QWidget
      {
      public:
      Buttons() : QWidget( 0 )
      {
      setGeometry( 50, 50, 300, 300 );
      QGridLayout * l = new QGridLayout();
      QButtonGroup * gp = new QButtonGroup();
      gp->setExclusive( true );
      for ( int i = 0; i < 100; i++ )

      { QPushButton * b = new QPushButton( QString().number( i+1 ), this ); QSizePolicy p( b->sizePolicy() ); p.setVerticalPolicy( QSizePolicy::MinimumExpanding ); b->setSizePolicy( p ); b->setCheckable( true ); gp->addButton( b ); l->addWidget( b, i/10, i%10 ); }

      setLayout( l );
      }
      };

      int main( int argc, char * argv[] )
      {
      QApplication * theApp = new QApplication( argc, argv );
      Buttons * b = new Buttons();
      b->setVisible( true );
      return theApp->exec();
      }
      --------------------------------------

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

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes