I want to wrap the Qt connect method (Qt5 syntax), but can't get my code to compile. The simplest example I can come up with is (not tested, just general idea):
// Called like this
doConnect(&obj1,&obj1:sig,&obj2,&obj2::slot);
// Implemented here
void namespace::doConnect(
const QObject* senderObject,
const QMetaMethod& senderSignal, {
const QObject* receiverObject,
const QMetaMethod& receiverSlot) {
connect(senderObject, senderSignal, receiverObject, receiverSlot);
}
When I try to compile this I get an error on the line that calls doConnect,
"no matching function for call to doConnect"
and on the connect line
error: static assertion failed: Signal and slot arguments are not compatible.
Which sounds like signal and slot have different/incompatible arguments. However, if I call connect directly by putting the sender object/signal and receiver object/slot in the connect command it works fine. So it's not signature of signal/slot issue.
What is wrong here? Does passing the parameters to a function first hide some information that the connect function (or macro or template) needs?