[Qt-interest] check box problem

Ramesh ramesh.bs at robosoftin.com
Wed May 12 13:35:53 CEST 2010


Hi, all

 

What is the mistake in this code,

Initially, all the check boxes will be selected, later if I click first
checkbox, it will get untick, later if I click on the first box again, it
will get selected but the second one will be unticked.. similarly if I
reaped the process, the third box also get unticked.. my I know where I am
wrong.

 

Here is the code L

 

QtRadioButtons::QtRadioButtons(QWidget *parent)

    : QMainWindow(parent)

{

    //ui.setupUi(this);

 

    RadioButtonwidget *myradio = new RadioButtonwidget();

    setCentralWidget(myradio);

    

         

}

 

QtRadioButtons::~QtRadioButtons()

{

 

}

 

RadioButtonwidget::RadioButtonwidget(QWidget *parent)

    : QWidget(parent)

{

    

 

         QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons"));

 

         QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1"));

         

 
QObject::connect(radio1,SIGNAL(clicked(bool)),this,SLOT(clickkedstate(bool))
);

         

         QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2"));

         

 
QObject::connect(radio2,SIGNAL(clicked(bool)),this,SLOT(clickkedstate(bool))
);

         

         QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3"));

         

 
QObject::connect(radio3,SIGNAL(clicked(bool)),this,SLOT(clickkedstate(bool))
);

 

         radio1->setChecked(true);

         radio2->setChecked(true);

         radio3->setChecked(true);

         

 

         QVBoxLayout *vbox = new QVBoxLayout;

         vbox->addWidget(radio1);

         vbox->addWidget(radio2);

         vbox->addWidget(radio3);

         vbox->addStretch(1);

         groupBox->setLayout(vbox);

         setLayout(vbox);

    

    

}

 

RadioButtonwidget::~RadioButtonwidget()

{

 

}


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100512/f0a4f97a/attachment.html 


More information about the Qt-interest-old mailing list