当前位置:网站首页>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
边栏推荐
- MPLS configuration
- 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
- The 15 year old interviewer will teach you four unique skills that you must pass the interview
- 第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
- BOC protected tryptophan porphyrin compound (TAPP Trp BOC) Pink Solid 162.8mg supply - Qiyue supply
- About callback function and hook function
- Flume learning notes
- [raid] [simple DP] mine excavation
- 2022-06-27 advanced network engineering (XII) IS-IS overhead type, overhead calculation, LSP processing mechanism, route revocation, route penetration
- [effective Objective-C] - block and grand central distribution
猜你喜欢
Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
01 - QT OpenGL display OpenGL window
Leetcode 1189. Maximum number of balloons (special character count)
HCIA-USG Security Policy
BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke
How to improve data security by renting servers in Hong Kong
05 -- QT OpenGL draw cube uniform
2022 Xinjiang latest construction eight members (standard members) simulated examination questions and answers
2022-06-27 网工进阶(十二)IS-IS-开销类型、开销计算、LSP的处理机制、路由撤销、路由渗透
PR 2021 quick start tutorial, material import and management
随机推荐
交叉编译Opencv带Contrib
BOC protected tryptophan zinc porphyrin (Zn · TAPP Trp BOC) / copper porphyrin (Cu · TAPP Trp BOC) / cobalt porphyrin (cobalt · TAPP Trp BOC) / iron porphyrin (Fe · TAPP Trp BOC) / Qiyue supply
Chapter 2: find the box array, complete number in the specified interval, and improve the complete number in the specified interval
Geek Daily: the system of monitoring employees' turnover intention has been deeply convinced off the shelves; The meta universe app of wechat and QQ was actively removed from the shelves; IntelliJ pla
Chapitre 1: le roi de shehan a mal calculé
2022-06-25 网工进阶(十一)IS-IS-三大表(邻居表、路由表、链路状态数据库表)、LSP、CSNP、PSNP、LSP的同步过程
How to check the permission to write to a directory or file- How do you check for permissions to write to a directory or file?
NFT without IPFs and completely on the chain?
BUUCTF
PR notes:
Nacos usage of micro services
02 -- QT OpenGL drawing triangle
01 - QT OpenGL display OpenGL window
Chapter 1: seek common? Decimal and S (D, n)
Chapter 1: find all factorial sums, Grand Prix site unified programming, three factorial sums, graphic point scanning, recursive factorial n of n!, Find the factorial n of n!, King Shehan miscalculate
unittest框架基本使用
04 -- QT OpenGL two sets of shaders draw two triangles
Xctf attack and defense world crypto advanced area best_ rsa
BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke
第一章:递归求n的阶乘n!