As you noticed, code below report a runtime error reporting incompatibility between signal
and slot
:
QObject::connect( &c, SIGNAL( value( A::B* ) ), &a, SLOT( onValue( B* ) ) );
Error is:
QObject::connect: Incompatible sender/receiver arguments
C::value(A::B*) --> A::onValue(B*)
This is because SIGNAL
and SLOT
are macros and the compatibility of calls is resolved at runtime and fails this case when it should work as A::B
and B
are the same (most likely because it's apparently a simple text comparison).
But this is an old style connection command (pre Qt5).
With the new style connection command:
QObject::connect( &c, &C::value, &a, &A::onValue );
No error is reported at compilation time, nor at runtime and the connection will work.