QT QRadiobutton设置选中

  • setChecked();设置选中

 

  QButtonGroup *block1=new QButtonGroup(this);
  QButtonGroup *block2=new QButtonGroup(this);
    block1->addButton(ui->wireless_net_auto_ip_rbutton,0);//一个值为0
    block1->addButton(ui->wireless_net_man_ip_rbutton,1);//一个值为1
    ui->wireless_net_auto_ip_rbutton->setChecked(1);

    block2->addButton(ui->wireless_net_auto_DNS_rbutton,0);
    block2->addButton(ui->wireless_net_man_DNS_rbutton,1);
    ui->wireless_net_auto_DNS_rbutton->setChecked(1);
  •  结果:

你可能感兴趣的:(QT)