当前位置:网站首页>QT tutorial: signal and slot mechanism
QT tutorial: signal and slot mechanism
2022-07-03 19:53:00 【Cheems_ Pak Choi】
One 、 Connection of signal and slot
1、QT5 Writing above version :
connect(xxx,&yyy,this,&zzz);
xxx: Sender of signal , This parameter is a pointer
&yyy: Signaler , An internal signal ( Format :& + The name of the signaler class + :: + Signal name ), To add an address symbol
this: The receiver of the signal , This parameter is also a pointer ( Is not necessarily this)
&zzz: Signal processing function , To add an address symbol , It belongs to this,
2、QT edition 5 The following is a way to write :
connect(xxx,SIGNAL(yyy()),this,SLOT(zzz()));
xxx: Sender of signal , This parameter is a pointer
yyy(): Signaler
this: The receiver of the signal , This parameter is also a pointer ( Is not necessarily this)
zzz(): Signal processing function , It belongs to this,
Two 、 Custom slot function
1、 Slot function in Qt5, It can be any class member function 、 Global function 、 Static functions 、lambda expression ( Implicit functions )
2、 The slot function needs to correspond to the signal ( Return value 、 Parameters )
for example :
void mysignal(int ,double,QString);// The signal
void myslot(int ,double,QString);// Slot function
3、 The signal has no return value , The return value of the slot function :void
4、 The parameters of the slot function are to receive the data transmitted by the signal
5、 The parameters of the slot function should not be greater than the number of parameters of the signal , The parameters of the slot function can be less than the number of parameters of the signal
6、 Slot functions can be overloaded
7、 stay “private slots:” Make a statement or “public slots:” Make a statement
3、 ... and 、 Custom signal
1、 Must be in “signals:” Make a statement
2、 There can be parameters
3、 Overloading can happen
4、 The return value is Void
5、 Sending signal :emit+ Signal name
Four 、hide() function
It means to hide the current window
5、 ... and 、static
Static value , for example static int i = 0; It means static Zheng Xingzhi i, It will not be rebuilt later i=0, Instead, keep the last value
边栏推荐
- BOC protected alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC supplied by Qiyu
- Cross compile opencv with contrib
- Utilisation de base du cadre unitest
- Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu
- Gym welcomes the first complete environmental document, which makes it easier to get started with intensive learning!
- 2022-06-25 网工进阶(十一)IS-IS-三大表(邻居表、路由表、链路状态数据库表)、LSP、CSNP、PSNP、LSP的同步过程
- 第一章: 舍罕王失算
- PR notes:
- Zhang Fei hardware 90 day learning notes - personal record on day 5. Please see my personal profile / homepage for the complete record
- HCIA-USG Security Policy
猜你喜欢

第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数

2022-06-27 advanced network engineering (XII) IS-IS overhead type, overhead calculation, LSP processing mechanism, route revocation, route penetration

I study database at station B (4): DQL

2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
![第二章:基于分解的求水仙花数,基于组合的求水仙花数, 兰德尔数,求[x,y]内的守形数,探求n位守形数,递推探索n位逐位整除数](/img/c5/0081689817700770f6210d50ec4e1f.png)
第二章:基于分解的求水仙花数,基于组合的求水仙花数, 兰德尔数,求[x,y]内的守形数,探求n位守形数,递推探索n位逐位整除数

Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu

Leetcode 1189. Maximum number of balloons (special character count)

Wechat applet quick start (including NPM package use and mobx status management)

Chapter 1: find the algebraic sum of odd factors, find the same decimal sum s (D, n), simplify the same code decimal sum s (D, n), expand the same code decimal sum s (D, n)

IPv6 experiment
随机推荐
Gym welcomes the first complete environmental document, which makes it easier to get started with intensive learning!
Promethus
P5.js development - setting
Part 28 supplement (XXVIII) busyindicator (waiting for elements)
2022-06-25 advanced network engineering (XI) IS-IS synchronization process of three tables (neighbor table, routing table, link state database table), LSP, cSNP, psnp, LSP
Win10 share you don't have permission
Xctf attack and defense world crypto master advanced area olddriver
Chapter 1: drinking soft drinks, step tariff calculation, step tariff calculation function, personal income tax, solving square root inequality, simplifying solving square root inequality, solving dem
UE source code analysis: uccharactermovementcomponent - rootmotion
2022 Xinjiang latest construction eight members (standard members) simulated examination questions and answers
Summary of learning materials and notes of Zhang Fei's actual combat electronics 1-31
Use unique_ PTR forward declaration? [repetition] - forward declaration with unique_ ptr? [duplicate]
第一章:喝汽水,阶梯电费计算,阶梯电费计算函数,个人所税,求解平方根不等式,简化求解平方根不等式,求解调和级数不等式,解不等式:d<1+1/2-1/3+1/4+1/5-1/6+..士1/n
Micro service knowledge sorting - three pieces of micro Service Technology
About callback function and hook function
Kubernetes cluster builds efk log collection platform
Parental delegation mechanism
Pat grade B 1009 is ironic (20 points)
QT -- qfileinfo file information reading
Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu