
Originally Posted by
blackliteon
I'll be very pleased If you will!
And a little question: when we load plugin (PluginLoader::instance) we get pointer to _realized_object_ ? We cannot get class from plugin ? Tell me, please.
Maybe I don't understand plugin theory at all.
You get a pointer to a class which knows how to create objects (called object factory), at least that's one of potential designs. The other is to get the object directly.
Factory:
struct IFactory {
virtual QObject *createObject
() = 0;
}; // pure abstract class
class MyFactory : public IFactory {
public:
QObject *createObject
(){ return new MyObject
();
} };
struct IFactory {
virtual QObject *createObject() = 0;
}; // pure abstract class
class MyFactory : public IFactory {
public:
QObject *createObject(){ return new MyObject(); }
};
To copy to clipboard, switch view to plain text mode
In the second case (without factories), "MyFactory" is already a class which you use in your app and it is created by the plugin loader.
Bookmarks