Search code examples
c++qtargumentssignals-slots

Qt Connect signals with different arguments


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?

Is that considered safe?

Thanks & Cheers!


Solution

  • 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()