1、3以后尽量手写,因为没有现在的控件了
2、
1 // lyy : 2016/8/26 12:17:41 说明:存放radioButton 2 QButtonGroup *buttonGroup; 3 // lyy : 2016/8/26 11:11:55 说明:radioButton 4 buttonGroup = new QButtonGroup(); 5 buttonGroup->addButton (ui.noSpace_Btn, 0); 6 buttonGroup->addButton (ui.smallSpace_Btn, 1); 7 buttonGroup->addButton (ui.mediumSpace_Btn, 2); 8 buttonGroup->addButton (ui.bigSpace_Btn, 3); 9 10 // lyy : 2016/8/26 14:15:58 说明:用这种方法默认选择与mSelectRadioButton保持一致 11 QRadioButton *path = qobject_cast<QRadioButton*> (buttonGroup->button (mSelectRadioButton)); 12 path->setChecked (true); 13 14 connect (buttonGroup, SIGNAL (buttonClicked (int)), this, SLOT (buttonJudge (int)));
3、槽函数
1 void DailyPaper::buttonJudge (int iid) 2 { 3 quint16 a = buttonGroup->checkedId(); 4 QMessageBox::information (this, "test", QString::number (a)); 5 mSelectRadioButton = a; 6 // QMessageBox::information (this, "test1", QString::number (a)); 7 }