[Qt-interest] QT Plugin with signals
Andreas Pakulat
apaku at gmx.de
Wed Mar 31 15:28:09 CEST 2010
On 31.03.10 18:38:28, Mandeep Sandhu wrote:
> I'm writing a QT Plugin which needs to emit certain signals.
>
> Where should the signals be declared? In the interface or in the
> implementation class?
>
> I'm currently declaring the signal in the _implementation_ class (from
> where it's actually emitted). The implementation class inherits
> QObject.
>
> In the application I load the plugin using the QPluginLoader class.
> The app only has a reference of the plugin interface since only that
> is visible to it. When I try to connect the signal emitted by the
> implementation class to an apps slot, the compiler complains since
> connect expects a QObject* whereas my interface class is not a
> subclass of QObject.
>
> Whats the correct way of going about it?
If you want real interfaces that you can mix, then you'll have to expose
the plugin class somehow also as a QObject* for the connect to work. The
other option would be making your interface "fat" and let the interface
inherit from QObject..
Andreas
--
Long life is in store for you.
More information about the Qt-interest-old
mailing list