aamer4yu
5th December 2013, 08:19
I would like to know how to use new Qt Signals and Slots with classes of QtService Framework
The new syntax is of the type -
QObject::connect(&a, &Counter::valueChanged,&b, &Counter::setValue);
This provides compile time checks. So far good.
Now in Qt Service framework, we get an object of service via
QObject * QServiceManager::loadInterface ( const QServiceInterfaceDescriptor & descriptor, QServiceContext * context = 0, QAbstractSecuritySession * session = 0 )
This returns a pointer to QObject. Now we are expected to connect certain signals from the service like "errorUnrecoverableIPCFault".
Now we have a pointer of QObject, and the actual service object may be of any type. Now how can I used the new syntax something like -
connect(pServiceObject,&QObject::errorUnrecoverableIPCFault,this,&MyClass::onErrorUnrecoverableIPCFault);
I cannot use the above format since QObject doesnt have signal errorUnrecoverableIPCFault
The signal is emitted from somewhere within Qt Service framework, and is also not part of my Service class implementation.
So my question is how to use new format of Signal Slots in such cases ??
The new syntax is of the type -
QObject::connect(&a, &Counter::valueChanged,&b, &Counter::setValue);
This provides compile time checks. So far good.
Now in Qt Service framework, we get an object of service via
QObject * QServiceManager::loadInterface ( const QServiceInterfaceDescriptor & descriptor, QServiceContext * context = 0, QAbstractSecuritySession * session = 0 )
This returns a pointer to QObject. Now we are expected to connect certain signals from the service like "errorUnrecoverableIPCFault".
Now we have a pointer of QObject, and the actual service object may be of any type. Now how can I used the new syntax something like -
connect(pServiceObject,&QObject::errorUnrecoverableIPCFault,this,&MyClass::onErrorUnrecoverableIPCFault);
I cannot use the above format since QObject doesnt have signal errorUnrecoverableIPCFault
The signal is emitted from somewhere within Qt Service framework, and is also not part of my Service class implementation.
So my question is how to use new format of Signal Slots in such cases ??