[Qt-interest] Could I use a QObject based class to create Qt Plugin?

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Wed Oct 13 08:48:16 CEST 2010


2010/10/13 danny <tornadory at 163.com>:
> Hi all,
>
> From
> http://doc.qt.nokia.com/4.6/plugins-howto.html#the-lower-level-api-extending-qt-applications,
> I saw the methods to create a Qt Plugin, and from the example I saw that the
> Interface Class should be a virtual Class , so it could not inherit from
> QObject, is it right?

You can extend it from a QObject. Only the methods defined in the
interface class need be pure virtual.

>
> If I want the Plugins have its signal/slot, how could I do?  I want to use
> the interface class object and connect some signals from/to it.

You need not (but you can) extend from QObject in the interface class
for signals/slots. You can have the class implementing the interface
extend from QObject and then declare signals/slots there. And if the
user of the plugins know which singal/slots to use, then they can
directly connect them.

However, I prefer to extend my interface from QObject and declare all
signals/slots there as thats really the only way to infor the external
users of the plugin as to what signals/slots your plugin exposes.

Check the list archives, I had asked a similar question before on this list.

HTH,
-mandeep


>
> Any ideas to help me?
>
> Thanks in advance.
>
>
> --
>  Best Regards,
>
>
>
> ________________________________
> 全国最低价,天天在家冲照片,24小时发货上门!
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list