qt radiobutton选中状态怎么设置

lewis 2017-10-23 18次阅读

要设置Qt中的RadioButton控件的选中状态,可以使用setChecked(bool)函数。将bool参数设置为true表示选中,设置为false表示未选中。

代码示例:

// 创建RadioButton控件
QRadioButton *radioButton = new QRadioButton("Option 1", this);

// 设置选中状态
radioButton->setChecked(true); // 选中
radioButton->setChecked(false); // 未选中

这样就可以设置RadioButton控件的选中状态了。



发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。