当前位置:网站首页>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();
}
边栏推荐
- Unity learning shader notes [82] black and white processing of enhanced single channel color rendering
- Wechat nucleic acid detection appointment applet system graduation design (2) applet function
- Which securities company has a low, safe and reliable online account opening commission
- Three ways of function parameter transfer in C language
- Use dosbox to run the assembly super detailed step "suggestions collection"
- Qt Official examples: Qt Quick Controls - Gallery
- [Oracle final review] addition, deletion and modification of tablespaces, tables, constraints, indexes and views
- NM01-独立于总线协议的NM模块功能概述与API定义
- Simulateur nightGod + application de test de capture de paquets Fiddler
- Web实时通信技术之Websocket
猜你喜欢

文字编辑器 希望有错误的句子用红色标红,文字编辑器用了markdown

Troubleshooting ideas that can solve 80% of faults

Qt官方示例:Qt Quick Controls - Gallery

QT official example: QT quick controls - Gallery

初夏,开源魔改一个带击杀音效的电蚊拍!

Another double non reform exam 408, will it be cold? Software College of Nanchang Aviation University

Leetcode interview question 17.04 Vanishing numbers
![[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations](/img/15/298ea6f7367741e1e085007c498e51.jpg)
[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations

Leetcode 面试题 16.17. 连续数列

300+ documents! This article explains the latest progress of multimodal learning based on transformer
随机推荐
27:第三章:开发通行证服务:10:【注册/登录】接口:注册/登录OK后,把用户会话信息(uid,utoken)保存到redis和cookie中;(一个主要的点:设置cookie)
PR曲线和ROC曲线概念及其区别
Qt Official examples: Qt Quick Controls - Gallery
Rte11 interrupt decoupling function
promise 和 Observable 的区别
Radian to angle, angle to radian in MATLAB
怎么用ps提取图片颜色分析色彩搭配
Détends - toi encore! Ces nouveaux étudiants peuvent s'installer directement à Shanghai
C语言中函数参数传递的三种方式
Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用
Please, stop painting star! This has nothing to do with patriotism!
Redis(7)----数据库与过期键
又一所双非改考408,会爆冷么?南昌航空大学软件学院
Uncover the whole link communication process of dewu customer service im
The official docker image running container in version 1.5.1 can be set to use MySQL 8 driver?
Concepts and differences of PR curve and ROC curve
@Component 拿不到dao层
Web实时通信技术之Websocket
揭秘得物客服IM全链路通信过程
Meal card hdu2546