[Interest] QPlugin and RTTI

Roland Winklmeier roland.m.winklmeier at gmail.com
Wed Jun 18 17:56:02 CEST 2014


>
> Then the plugin will derive from one of the DerivedX classes, and provide
> a method in the interface which will list its implemented derived class
> names as strings, and provide a factory for them returning Base* objects.
>
> Then, the app will dynamic_cast these pointers to DerivedA, DerivedB,
> etc...
>
> Will the dynamic_cast work? Is there a special way to export/declare
> things for that?
>

Do you have specific requirements, which prevent you from using Qt's plugin
system entirely or do you have to use the string approach? You could load
the plugin with QPluginLoader and test whether it implements a given
interface by using qobject_cast().
See
http://qt-project.org/doc/qt-4.8/plugins-howto.html#the-lower-level-api-extending-qt-applications
for details.

Not sure if one single plugin can export more than one interface though,
but I hope so :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140618/1d79b8cf/attachment.html>


More information about the Interest mailing list