当前位置:网站首页>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 .
边栏推荐
- [CEPH] Introduction to cephfs caps
- A blog to thoroughly master the theory and practice of particle filter (PF) (matlab version)
- Unity C # e-learning (10) -- unitywebrequest (1)
- 【C语言练习——打印空心上三角及其变形】
- 在哪个平台买股票开户安全?求指导
- RestCloud ETL解决shell脚本参数化
- Restcloud ETL resolves shell script parameterization
- 【ceph】CephFS 内部实现(四):MDS是如何启动的?--未消化
- 小程序:uniapp解决 vendor.js 体积过大的问题
- Notes on brushing questions (19) -- binary tree: modification and construction of binary search tree
猜你喜欢
![[tcapulusdb knowledge base] Introduction to tcapulusdb system management](/img/5a/28aaf8b115cbf4798cf0b201e4c068.png)
[tcapulusdb knowledge base] Introduction to tcapulusdb system management

Comparative analysis of restcloud ETL and kettle

【ceph】cephfs的锁 笔记

Don't remove custom line breaks on reformat

Unable to download Plug-in after idea local agent
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction](/img/05/8ec56393cac534cb5a00c10a1a9f32.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction

一篇博客彻底掌握:粒子滤波 particle filter (PF) 的理论及实践(matlab版)
![[tcapulusdb knowledge base] Introduction to tcapulusdb general documents](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[tcapulusdb knowledge base] Introduction to tcapulusdb general documents

HR export data Excel VBA
随机推荐
【ceph】CephFS 内部实现(二):示例--未消化
夏令营来啦!!!冲冲冲
Shell script multi process concurrent writing method example (high level cultivation)
Use of abortcontroller
Talk about the recent situation of several students from Tsinghua University
High frequency interview 𞓜 Flink Shuangliu join
[tcapulusdb knowledge base] Introduction to tcapulusdb system management
有Cmake的工程交叉编译到链接时报错找不到.so动态库文件
5 figures illustrate the container network
编译配置in文件
How to load the contour CAD drawing of the engineering coordinate system obtained by the designer into the new earth
Ansible自动化的运用
【ceph】cephfs caps简介
JS之事件
Audio and video learning (I) -- PTZ control principle
整理了一批脚本标准的函数模块(2021版)
【TcaplusDB知识库】TcaplusDB运维单据介绍
SAP sales data actual shipment data export sales
Unable to download Plug-in after idea local agent
[CEPH] cephfs internal implementation (II): example -- undigested