当前位置:网站首页>QT qbuttongroup realizes single selection and multiple selection
QT qbuttongroup realizes single selection and multiple selection
2022-07-28 14:51:00 【Love the west wind】
One 、QButtonGroup brief introduction
QButtonGroup Inherited from QObject, Not a visual class , It mainly groups the keys , Easy key management .
Two 、 function (API)
1. View button and set button ID, Achieve radio , multi-select , After clicking, get the clicked button by signal ID;
3、 ... and 、 combination QRadioButton,QCheckButton,QPushButton And so on. QAbstractButton Object implementation of class
Examples :
QButtonGroup* mButtonGroup;
mCheckBoxGroup = new QButtonGroup();
mCheckBoxGroup->setExclusive(false); // Set this button group to mutually exclusive mode true Mutually exclusive
QCheckBox *checkBoxA = new QCheckBox();
QCheckBox *checkBoxB = new QCheckBox();
for (int i = 0; i <2; i++)
{
mButtonGroup->addButton(*checkBoxA, i);
mCheckBoxGroup->addButton(*checkBoxB, i);
}
// Connecting signals and slots
connect(mCheckBoxGroup, SIGNAL(buttonClicked(int)), this, SLOT(slot_CheckBoxGroupClicked(int)));
void ACLManualSegmentationUnityWidget::slot_CheckBoxGroupClicked(int id)
{
if( mCheckBoxGroup->->button(id)->isChecked())// It can be seen here that Which is more specific button id state
{
qDebug()<< QString::number(id); <<"checked true";
}
else
{
qDebug()<< QString::number(id); <<"checked false";
}
}边栏推荐
- First class exercise
- C语言库函数getchar()怎么使用
- [leetcode] 1331. Array sequence number conversion
- Switch the cloud synchronization status of core data in real time
- Interviewer: what are the usage scenarios of ThreadLocal? How to avoid memory leakage?
- 围绕新市民金融聚焦差异化产品设计、智能技术提效及素养教育
- Node文件操作
- TDengine 助力西门子轻量级数字化解决方案
- Redis configuration file explanation
- 基础架构之日志管理平台及钉钉&邮件告警通知
猜你喜欢

linux安装redis

2022 low voltage electrician examination questions and answers

58子站安居,经纪人营销管理平台登录接口加密逆向

Another way of understanding the essence of Hamming code

多所“双一流”大学,保研预报名启动!

树莓派基础 | 总结记录树莓派学习过程中的一些操作

爆肝整理JVM十大模块知识点总结,不信你还不懂

35道MySQL面试必问题图解,这样也太好理解了吧

When Xcode writes swiftui code, it is a small trap that compiles successfully but causes the preview to crash

八、picker用法 下拉框选择效果
随机推荐
Chi square distribution and gamma function
Several methods of opening URL in swiftui view
Third class exercise
The second pre class exercise
Some problems encountered in the development of Excel VBA, solutions, and continuous updates
Switch the cloud synchronization status of core data in real time
用 Table 在 SwiftUI 下创建表格
九、uni-popup用法 下拉框底部弹窗效果
SwiftUI 布局 —— 尺寸( 下 )
ssh服务
Brief introduction and use of mqtt entry level
Redis configuration file explanation
9、 Uni popup usage popup effect at the bottom of the drop-down box
Various pitfalls encountered in UI development
Langjing Technology (Trax China) "robot +ai" opens the era of Chinese retail meta universe
Raspberry pie foundation | summarize and record some operations in the learning process of raspberry pie
八、picker用法 下拉框选择效果
[leetcode] 1331. Array sequence number conversion
The 35 required questions in MySQL interview are illustrated, which is too easy to understand
Swiftui 4.0's new navigation system