Is it valid to call
QObject::connect(a, SIGNAL(somesig(someparam)), b, SLOT(someslot()));
without params? It seems to work (no runtime exception thrown) but I can't find a reference in the docs. All I found is that this is possible if someslot has a default parameter. It is valid in this case. But my method someslot has not the same parameter set as default (no parameter here in the example).
So it seems to be possible to wire signals to slots with less parameters?
Yes, that's fine. There's a short sentence about it in the Signals & Slots documentation:
[...] The signature of a signal must match the signature of the receiving slot. (In fact a slot may have a shorter signature than the signal it receives because it can ignore extra arguments.) [...]
There's even an example like that further down the page where default arguments are explained.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With