Reputation: 2696
I have a problem with the QServiceManager.
QServiceManager manager;
CFoo bar;
QList<QServiceInterfaceDescriptor> ServiceList = manager.findInterfaces(SERVICE_NAME);
for(int i = 0; i < ServiceList.length(); i++)
{
bool accessGranted = false;
QServiceInterfaceDescriptor descriptor = ServiceList[i];
if (descriptor.interfaceName() == INTERFACE)
{
bar = manager.loadLocalTypedInterface<IFoo>(descriptor, accessGranted);
if (NULL == bar && false == accessGranted)
{
connect(bar, SIGNAL(signal()),
this, SLOT(slot()));
}
}
}
I can do function calls specified in the interface IFoo on bar, like:
bar.function()
and I see that the remote object foo is receiving the function call, but when I send the signal remotely:
class IFoo : public QObject
{
Q_OBJECT
public:
virtual void function() = 0:
signals:
void signal();
};
class CFoo : public IFoo`
{
Q_OBJECT
void function()
{
emit signal();
}
};
it is not received. The function slot() is never called. I checked that the connect function gets called and returns TRUE. Can anybody pinpoint what I am doing wrong?
Upvotes: 0
Views: 109
Reputation: 4607
Cant use signals and slots if your class isnt qobject
#include<QObject>
class CFoo : public QObject, public IFoo
{
Q_OBJECT
signals:
void signal();
public:
void function()
{
emit signal();
}
};
Upvotes: 1