PDA

View Full Version : Slots/Signals with dynamic library



astong
23rd August 2011, 21:52
Hello,

I have a Qt application which dynamically launch a library (with dlopen I think), which is called a controller. The controller don't use Qt at all.

I'd like to add a class which uses slots and signals and use this class in my controller. Unfortunately, I can't use slots and signals and I don't understand why. It seems that the signals are never emitted.

The connect() method returns true but the signals are never emitted.

I tried to instantiate a new QApplication in my class but it doesn't work. I guess that QApplication is already instantiate in the main program.

Is there any special instruction to do to use the power of slots and signals while using shared library ?

Thank you by advance.

SixDegrees
24th August 2011, 00:42
You can call any function through the signals/slots mechanism, but the connect, emit and receiver all have to be within the Qt framework. If you want to connect to an external library, you can put a thin wrapper class around its calls that act as slots or emit signals. Signals and slots, though, are a Qt construct and cannot be used directly by a non-Qt object.