当前位置:网站首页>Binding method of multiple sub control signal slots under QT
Binding method of multiple sub control signal slots under QT
2022-06-26 15:34:00 【A fat yard makes a strong man】
In some software interface development , You need to use the same batch of controls , For example, there are dozens of settings interfaces lineedit Input box , Or many checkbox Control , As shown in the figure below (qt Setting interface of ):
Which set , As long as a control makes changes, it needs to refresh and save parameters in real time , What's the plan ?
1、 If the control has rules , For example, the code uses for loop new The object of , We can do that new Add your slot function to the next loop .
2、 The second situation is separation new The object of , Does every object new All the time coonnect once ? If it is qt designed In the design interface, you can drag in the settings interface ?
In this case, we can use qt Of findChildren function , As shown in the following code :
QList<QCheckBox *> checkboxList = this->findChildren<QCheckBox *>();
for (int i = 0; i < checkboxList.size(); i++)
{
connect(checkboxList[i], &QCheckBox::clicked, this, [=]()
{
// The slot function you need to execute
}
}
Use the function to find all such control objects under the pop-up window , And put it in a pointer linked list , In this way, unified management can be done , For example, the signal slot connection we want .
边栏推荐
- [tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area
- 如何配置使用新的单线激光雷达
- 在重新格式化时不要删除自定义换行符(Don‘t remove custom line breaks on reformat)
- 一键安装gcc脚本
- Particle filter PF -- Application in maneuvering target tracking (particle filter vs extended Kalman filter)
- English grammar_ Adjective / adverb Level 3 - original sentence pattern
- Sikuli automatic testing technology based on pattern recognition
- Shell script multi process concurrent writing method example (high level cultivation)
- About selenium common. exceptions. Webdriverexception: message: an unknown server side error solution (resolved)
- php文件上传00截断
猜你喜欢

【TcaplusDB知识库】TcaplusDB单据受理-建表审批介绍
![[CEPH] MKDIR | mksnap process source code analysis | lock state switching example](/img/4a/0aeb69ae6527c65a67be535828b48a.jpg)
[CEPH] MKDIR | mksnap process source code analysis | lock state switching example

Particle filter PF - 3D CV target tracking with uniform motion (particle filter vs extended Kalman filter)

在重新格式化时不要删除自定义换行符(Don‘t remove custom line breaks on reformat)
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - table creation approval introduction](/img/66/f3ab0514d691967ad88535ae1448c1.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - table creation approval introduction
MySQL数据库基本SQL语句教程之高级操作
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction](/img/05/8ec56393cac534cb5a00c10a1a9f32.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction

【ceph】CephFS 内部实现(三):快照

1.会计基础--会计的几大要素(会计总论、会计科目和账户)

刷题笔记(十九)--二叉树:二叉搜索树的修改与构造
随机推荐
Using restcloud ETL shell component to schedule dataX offline tasks
One click analysis hardware /io/ national network performance script (strong push)
【SNMP】snmp trap 介绍、安装、命令|Trap的发送与接收代码实现
安全Json协议
JS handwritten bind, apply, call
Unable to download Plug-in after idea local agent
[CEPH] cephfs internal implementation (IV): how is MDS started-- Undigested
在重新格式化时不要删除自定义换行符(Don‘t remove custom line breaks on reformat)
Unity C # e-learning (IX) -- wwwfrom
在哪个平台买股票开户安全?求指导
sqlite加载csv文件,并做数据分析
php文件上传00截断
PHP file upload 00 truncation
[tcapulusdb knowledge base] Introduction to tcapulusdb data structure
学习内存屏障
Sikuli automatic testing technology based on pattern recognition
1.会计基础--会计的几大要素(会计总论、会计科目和账户)
Redis-集群
【ceph】CephFS 内部实现(三):快照
[graduation season · advanced technology Er] what is a wechat applet, which will help you open the door of the applet