具有不同参数的 Qt Connect 信号 [英] Qt Connect signals with different arguments
问题描述
我有一个简单的问题,请阅读关于 使用参数较少的插槽连接信号,当然还有 Qt 文档.
I have a simple question guys, reading the thread about connecting signals with slots with fewer arguments, and of course, the Qt documentation.
但是,我不需要用插槽连接信号.我实际上想将信号与参数较少的信号连接起来.
However, I do not need to connect signals with slots. I actually want to connect signals with signals with fewer arguments.
文档对插槽非常清楚,但是信号呢?
The documentation is very clear about slots, but what about signals?
这被认为是安全的吗?
谢谢&干杯!
推荐答案
没有区别.接收信号可以具有比发射信号更短的签名.因为它可以忽略额外的参数.您可以连接如下信号:
There is no difference. The receiving signal may have a shorter signature than the emitting signal. because it can ignore extra arguments. You can connect a signal like:
signal(int, int, int)
使用以下签名发出信号:
TO SIGNAL with the following signatures:
signal1(int, int, int)
signal2(int, int)
signal3(int)
signal4()
这篇关于具有不同参数的 Qt Connect 信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!