[Qt-interest] Slots and Signals with a dynamic library

Bo Thorsen bo at fioniasoftware.dk
Wed Aug 24 07:37:25 CEST 2011


Den 23-08-2011 20:29, Jean Noel skrev:
> Hello,
>
> I have a Qt application which dynamically launch a library, which is
> called a controller. The controller don't use Qt at all. The application
> and the controller are both compiled with cmake.
> I'd like to add a class which use slots and signal and use this class in
> my controller. Unfortunately, I can't use slots and signals and I don't
> understand why.
>
> 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. The application doesn't launch.
>
> Is there any special instruction to do to use the power of slots and
> signals while using shared library ?

When using plugins (which is your case here) it's a safe practice to 
access only interfaces in the application. In your case, I would 
probably choose to build a proxy class that has an interface exposed to 
the plugin (with a hook interface if necessary) and a QObject subclass 
implementing the interface on the other side.

This way you have a clean separation between the two parts of your 
application.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Qt-interest-old mailing list