当前位置:网站首页>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 .
边栏推荐
- Evaluate:huggingface detailed introduction to the evaluation index module
- Shell script multi process concurrent writing method example (high level cultivation)
- Redis cluster
- Ansible自动化的运用
- MongoDB系列之适用场景和不适用场景
- 买股票通过券商经理的开户二维码开户资金是否安全?想开户炒股
- 【TcaplusDB知识库】TcaplusDB系统用户组介绍
- # 粒子滤波 PF——三维匀速运动CV目标跟踪(粒子滤波VS扩展卡尔曼滤波)
- Unity C# 网络学习(九)——WWWFrom
- Smoothing data using convolution
猜你喜欢
Evaluation - TOPSIS
【TcaplusDB知识库】TcaplusDB数据构造介绍
BLE抓包调试信息分析
【TcaplusDB知识库】TcaplusDB常规单据介绍
【TcaplusDB知识库】TcaplusDB OMS业务人员权限介绍
【TcaplusDB知识库】TcaplusDB单据受理-事务执行介绍
【TcaplusDB知识库】TcaplusDB运维单据介绍
Unable to download Plug-in after idea local agent
sqlite加载csv文件,并做数据分析
Particle filter PF - 3D CV target tracking with uniform motion (particle filter vs extended Kalman filter)
随机推荐
【TcaplusDB知识库】TcaplusDB数据构造介绍
【SNMP】snmp trap 介绍、安装、命令|Trap的发送与接收代码实现
Sorted out a batch of script standard function modules (version 2021)
vue中缓存页面 keepAlive使用
# 粒子滤波 PF——三维匀速运动CV目标跟踪(粒子滤波VS扩展卡尔曼滤波)
买股票通过券商经理的开户二维码开户资金是否安全?想开户炒股
Particle filter PF -- Application in maneuvering target tracking (particle filter vs extended Kalman filter)
5张图诠释了容器网络
How to load the contour CAD drawing of the engineering coordinate system obtained by the designer into the new earth
Restcloud ETL extracting dynamic library table data
RestCloud ETL抽取动态库表数据实践
学习内存屏障
Use of abortcontroller
通过券商经理的开户链接开股票账户安全吗?还是去证券公司开户安全?
PHP file upload 00 truncation
/etc/profile、/etc/bashrc、~/. Bashrc differences
Redis-集群
Notes on brushing questions (19) -- binary tree: modification and construction of binary search tree
Database - integrity constraints
sqlite加载csv文件,并做数据分析