I'm writing a subscription manager, the idea is that a signal and slot connection is created and multiple subscriptions can be hooked on the slot, when an update is received all subscriptions to the slot will be notified of the new data.
The issue is, that in my class that manages the subscriptions I am have a method called 'setupSubscription', here is the prototype:
void setupSubscription(enum eSlotID ID
,const QObject* pobjSender
,const QMetaMethod& pobjSignal
,const QMetaMethod& pobjSlot);
The enumerated type eSlotID contains a unique ID for each slot, the idea is that subscribers simple specify the ID to set-up a subscription.
Its in the early stages of development and the code for setupSubscription:
void clsSlotSub::setupSubscription(enum eSlotID ID
,const QObject* pobjSender
,const QMetaMethod& pobjSignal
,const QMetaMethod& pobjSlot) {
QObject::connect(pobjSender, pobjSignal, this, pobjSlot);
}
Of course there is a lot more to go in this yet, but this causes an error on compile:
error: no matching function for call to 'clsSlotSub::setupSubscription(clsSlotSub::eSlotID, Fcs::Mount*, void (Fcs::Mount::*)(Fcs::qfloat32), void (clsSlotSub::*)(float))'
,&clsSlotSub::update2Elevation);
^
I believe the prototype is correct having single stepped through the connect in the debugger before wrapping it in my setup method.
I'm not sure what the error means as the class implementation and prototype match and are present.
Example of usage:
msSlotSubMngr.setupSubscription(clsSlotSub::ELEVATION_ANGLE
,Fcs::Mount::GetRef()
,&Fcs::Mount::signalElevation
,&clsSlotSub::update2Elevation);
msSlotSubMngr is an instance of the slot subscription class.
This is the original code before wrapping and this compiles without any error:
QObject::connect(Fcs::Mount::GetRef()
,&Fcs::Mount::signalElevation
,mpobjElevStrip
,&clsElevStrip::elevationChanged);
When I single set the working code, this is the prototype for the connect method:
static QMetaObject::Connection connect(const QObject *sender
,const QMetaMethod &signal
,const QObject *receiver
,const QMetaMethod &method
,Qt::ConnectionType type = Qt::AutoConnection);
Declaration of eSlotID:
enum eSlotID {
...
/*1003*/ ,ELEVATION_ANGLE
...
};
Slot prototype:
void update2Elevation(float fltValue);
Slot implementation:
void clsSlotSub::update2Elevation(float fltValue) {
qDebug() << "clsSlotSub::New elevation: " << fltValue;
}