当前位置:网站首页>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();
}
边栏推荐
- SteamOS 3.3 Beta 发布,Steam Deck 中文键盘终于来了
- Web版3D可视化工具,程序员应该知道的97件事,AI前沿论文 | 资讯日报 #2022.07.01
- After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
- 距离度量 —— 杰卡德距离(Jaccard Distance)
- RDK simulation experiment
- Radian to angle, angle to radian in MATLAB
- 彻底搞懂基于Open3D的点云处理教程!
- Leetcode 面试题 16.11. 跳水板
- 又一所双非改考408,会爆冷么?南昌航空大学软件学院
- Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01
猜你喜欢
Wechat applet video sharing platform system graduation design completion (4) opening report
Leetcode interview question 16.17 Continuous sequence
Qt官方示例:Qt Quick Controls - Gallery
SteamOS 3.3 Beta 发布,Steam Deck 中文键盘终于来了
What is cloud primordial? This time, I can finally understand!
再放宽!这些应届生,可直接落户上海
Qt Official examples: Qt Quick Controls - Gallery
能解决80%故障的排查思路
Leetcode 面试题 16.11. 跳水板
文字编辑器 希望有错误的句子用红色标红,文字编辑器用了markdown
随机推荐
文字编辑器 希望有错误的句子用红色标红,文字编辑器用了markdown
Leetcode interview question 17.04 Vanishing numbers
“栈”的典型应用—表达式求值(C语言实现)
Is Guojin securities a state-owned enterprise? Is it safe to open an account in Guojin securities?
Esp32-c3 introductory tutorial question ⑪ - ESP tls: create_ ssl_ handle failed, tls_ io_ instance->options. trusted_ certs null
哪个券商公司网上开户佣金低又安全又可靠
Wechat nucleic acid detection appointment applet system graduation design completion (5) task statement
The second bullet of AI development and debugging series: the exploration journey of multi machine distributed debugging
Pit encountered during installation of laravel frame
Rte11 interrupt decoupling function
PR曲线和ROC曲线概念及其区别
@Component 拿不到dao层
MySQL about only_ full_ group_ By limit
距离度量 —— 杰卡德距离(Jaccard Distance)
Wechat applet video sharing platform system graduation design completion (4) opening report
【Oracle 期末复习】表空间、表、约束、索引、视图的增删改
How to set vscode to delete the whole line shortcut key?
Memory mapping of QT
2020 Internet industry terminology
1.5.1版本官方docker镜像运行容器,能设置使用 mysql 8驱动吗?