如何从QT中的RadioButton获得价值
How to get value from radiobutton in qt?
我在GroupBox中有很多radiobutton,我想获取已检查的RadioButton的文本数据。但是我不想写很多"否则",我的意思是
if (ui->radiobutton->isChecked)
// method's
else if (ui->radiobutton->isCheked)
// method's
..
..
有什么办法可以理解在特定组箱中检查哪个RadioButton?如果可能的话,请给我一个例子吗?
您可以使用qbuttongroup作为父:http://doc.qt.io/qt-5/qbuttongroup.html#checkedbutton
qabstractbutton * qbuttongroup :: checkedbutton()const
返回按钮组的检查按钮,或0如果没有按钮 检查。
另请参见ButtonClicked()。
相关文章:
- 将成员变量添加到共享库中的类中,不会破坏二进制兼容性吗
- .cpp和.h文件中的模板专用化声明
- 反向给定链表中的K节点
- 正在查找文档以获得PS4平台的C++中的设备信息
- enum是C++中的宏变量还是整数变量
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 将字符串存储在c++中的稳定内存中
- 文本文件中的单词链表
- 递归函数计算序列中的平方和(并输出过程)
- 如何从C++中的依赖类型中获得它所依赖的类型
- C++中的"inline"关键字
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 用C++中的一个变量定义一个常量
- vector.resize()中的分配错误
- 使用指针从C++中的数组中获取最大值
- arr[-1]在c++中的奇怪行为
- 具有奇怪重复模板模式的派生类中的成员变量已损坏
- 将值指定给向量(2D)的向量中的某个位置
- 如何从QT中的RadioButton获得价值