温馨提示×

qt radiobutton选中状态怎么设置

qt
小亿
447
2023-11-15 00:19:11
栏目: 编程语言

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

代码示例:

// 创建RadioButton控件 QRadioButton *radioButton = new QRadioButton("Option 1", this); // 设置选中状态 radioButton->setChecked(true); // 选中 radioButton->setChecked(false); // 未选中 

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

0