当前位置:网站首页>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();
}
边栏推荐
- Simulateur nightGod + application de test de capture de paquets Fiddler
- 300+ documents! This article explains the latest progress of multimodal learning based on transformer
- exness深度好文:动性系列-黄金流动性实例分析(五)
- Nm02 nm module call sequence diagram and code interpretation independent of bus protocol
- Leetcode interview question 16.11 Diving board
- Night God simulator +fiddler packet capture test app
- 又一所双非改考408,会爆冷么?南昌航空大学软件学院
- SAP S/4HANA OData Mock Service 介绍
- 服务器php环境搭建教程,PHP服务端环境搭建图文详解
- Redis(7)----数据库与过期键
猜你喜欢

彻底搞懂基于Open3D的点云处理教程!
![[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

Wechat applet video sharing platform system graduation design completion (7) Interim inspection report

距离度量 —— 杰卡德距离(Jaccard Distance)

SteamOS 3.3 Beta 发布,Steam Deck 中文键盘终于来了

Web版3D可视化工具,程序员应该知道的97件事,AI前沿论文 | 资讯日报 #2022.07.01

Redis(7)----数据库与过期键

A simple PHP personal card issuing program v4.0

Redis (6) -- object and data structure

Leetcode interview question 17.01 Addition without plus sign
随机推荐
Chrome officially supports MathML, which is enabled in chromium dev 105 by default
RDK simulation experiment
SAP S/4HANA OData Mock Service 介绍
[Oracle final review] addition, deletion and modification of tablespaces, tables, constraints, indexes and views
Basic idea of quick sorting (easy to understand + examples) "suggestions collection"
Redis(7)----数据库与过期键
Rte11 interrupt decoupling function
AI开发调试系列第二弹:多机分布式调测探索之旅
In early summer, Kaiyuan magic changed an electric mosquito racket with killing sound effect!
Unity learning shader notes [81] simple color adjustment post-processing (brightness, saturation, contrast)
Leetcode 面试题 16.11. 跳水板
Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用
夜神模擬器+Fiddler抓包測試App
iframe嵌套详解
Simulateur nightGod + application de test de capture de paquets Fiddler
Is Guojin securities a state-owned enterprise? Is it safe to open an account in Guojin securities?
options should NOT have additional properties
Leetcode 面试题 16.17. 连续数列
StretchDIBits函数
UE4 用spline画正圆