当前位置:网站首页>LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());
LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());
2022-07-02 17:10:00 【Licht小粉】
当某一个Object emit一个signal的时候,它就是一个sender,系统会记录下当前是谁emit出这个signal的,因此我们可以从对应的槽函数里面获得哪个发送的信号
有可能多个Object的signal会连接到同一个signal(例如多个Button可能会connect到一个slot函数onClick()),因此这是就需要判断到底是哪个Object emit了这个signal,根据sender的不同来进行不同的处理
QObject::Sender()返回发送信号的对象的指针,返回类型为QObject *
如下示例:
void LightLibCreateWidget::slotEffectCBClicked()
{
// 设置选择按钮
LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());
m_iSelectBtnIndex = sender->getLightIndex();
}
边栏推荐
- Leetcode(154)——寻找旋转排序数组中的最小值 II
- Wechat nucleic acid detection appointment applet system graduation design completion (5) task statement
- 学生抖音宣传母校被吐槽“招生减章”,网友:哈哈哈哈哈哈
- 问题包含哪些环节
- Leetcode interview question 17.01 Addition without plus sign
- Leetcode interview question 17.04 Vanishing numbers
- 饭卡 HDU2546
- Redis (7) -- database and expiration key
- Qt官方示例:Qt Quick Controls - Gallery
- 如何清理废弃pv和其对应的文件夹
猜你喜欢
RDK simulation experiment
Qt官方示例:Qt Quick Controls - Gallery
Unity learning shader notes [82] black and white processing of enhanced single channel color rendering
Implementation shadow introduction
Redis (7) -- database and expiration key
Esp32-c3 introductory tutorial question ⑩ - error: implicit declaration of function 'ESP_ blufi_ close‘;
夜神模拟器+Fiddler抓包测试App
又一所双非改考408,会爆冷么?南昌航空大学软件学院
Leetcode 面试题 17.04. 消失的数字
【愚公系列】2022年07月 Go教学课程 001-Go语言前提简介
随机推荐
Ue4 dessine un cercle avec une ligne de contour
Matlab中弧度转角度、角度转弧度
SteamOS 3.3 Beta 发布,Steam Deck 中文键盘终于来了
Eliminate the yellow alarm light on IBM p750 small computer [easy to understand]
Troubleshooting ideas that can solve 80% of faults
如何清理废弃pv和其对应的文件夹
夜神模拟器+Fiddler抓包测试App
Relax again! These fresh students can settle directly in Shanghai
UE4 用spline画正圆
In early summer, Kaiyuan magic changed an electric mosquito racket with killing sound effect!
Chain game system development (unity3d chain game development details) - chain game development mature technology source code
Wechat applet video sharing platform system graduation design completion (4) opening report
Wechat applet video sharing platform system graduation design completion (5) assignment
Stretchdibits function
Basic idea of quick sorting (easy to understand + examples) "suggestions collection"
StretchDIBits函数
Esp32-c3 introductory tutorial question ⑪ - ESP tls: create_ ssl_ handle failed, tls_ io_ instance->options. trusted_ certs null
The second bullet of AI development and debugging series: the exploration journey of multi machine distributed debugging
彻底搞懂基于Open3D的点云处理教程!
iptable端口重定向 MASQUERADE[通俗易懂]