[Qt-interest] Plugin framework

jjDaNiMoTh jjdanimoth at gmail.com
Tue Nov 24 14:22:30 CET 2009


2009/11/24 Tim Peeters <thjmpeeters at gmail.com>:
> Thanks Andreas,

[cut]
> I don't have the solution yet but I think (hope) that I am slowly getting
> closer. My guess was that there was an error with my CMake files, but I
> cannot find proper documentation on whether I need to do something special
> there to make plugins compile properly.
>
I don't have tried to compile your code, but I'm pretty sure that it
isn't a compilation error, but a runtime error.

> Should the plugin interfaces really be interfaces?

Yes (plugin _interfaces_) :D
> So all functions must be pure virtual?

Sure !

> Or can I implement a couple of functions that I can then use
> in all subclasses (i.e., plugins)?
In this case you must have a library that does the common function for
all plugins.

Could you post also the .pro file? Just for curiosity.
Also, don't use .load(), see the example: [1] that use

QPluginLoader pluginLoader(pluginDirectory.absoluteFilePath(fileName));
     QObject *plugin = pluginLoader.instance();
     if (plugin) {
         ....


[1] http://doc.trolltech.com/4.3/tools-echoplugin-echowindow-echowindow-cpp.html

-- 
Key Fingerprint
4588 F931 A6E7 C7D5 A302  3064 12EB E87F 9B28 A9D2



More information about the Qt-interest-old mailing list