2

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!

Community
  • 1
  • 1
senseiwa
  • 2,369
  • 3
  • 24
  • 47
  • Did you try? I think it should work: `connect(SIGNAL(foo(int, int)), SIGNAL(goo(int)));` – vahancho Mar 19 '14 at 08:38
  • Yes, it works, I've tried. But also it works if you set icons on widgets in a separate thread, but it is not guaranteed to always work. I was looking for an official doc... – senseiwa Mar 20 '14 at 06:55
  • How about SLOT has more argument than SIGNAL? – kien bui May 03 '18 at 09:44

1 Answers1

6

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()
Nejat
  • 31,784
  • 12
  • 106
  • 138
  • Thanks! I wonder why the documentation mentions only slots. Do you think they just forgot to mention signals? – senseiwa Mar 20 '14 at 06:54
  • 1
    Documentation tolds that there is no difference in connection. You may connect signals to signals in same way as signals to slots. – Dmitry Sazonov Mar 20 '14 at 08:16