[Qt-interest] QT Plugin with signals

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Wed Mar 31 15:08:28 CEST 2010


Hi All,

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?

I'm using the echo plugin example
(http://qt.nokia.com/doc/4.6/tools-echoplugin.html) as reference, but
unfortunately they don't show how a signal can be used in a plugin.

Any tips?

Thanks,
-mandeep



More information about the Qt-interest-old mailing list