Unsolved Trying to figure out the Plugin system
-
I’ve currently been working on a UI framework, in which all its functionality is loaded through plugins. The basic framework provides the a windowed shell, some custom widgets, a C++ API to talk to the cloud, and some other miscellaneous functionality.
For the plugins, I created a baseclass called ‘Plugin’, which is derived from Qobject. When instantiating this class, one must pas a few references to its constructor (which are all references to Qobjects). These pointers will be provided by the framework, when it loads the plugin.
When someone creates a plugin, they must derive their interface object from Plugin, they can use the references that were passed by the framework to interact with the application. The must be able to do operations to adding widgets to the Shell, or communicate with the cloud. Preferable they must also be able to communicate with other plugins, I don’t think this is possible/easy through C++ code (but correct me if I’m wrong :) ), but maybe through a messaging system.
I’ve finished most of the framework. I’m now at the point where I want to see some plugin action. I’ve already tried to come up with a good way to implement this kind of behavior. Imho, the Qt documentation is a bit lacking in this subject, in that it only describes some basic implementations. I’m having a hard time figuring out how to proceed. To me, this doesn’t seem like a trivial thing to do to. Is there anyone with some experience with building something such as this? Any advice would be greatly appreciated :). Thanks in advance !
-
Hi and welcome to devnet,
If you need some ideas/inspiration, take a look at Qt Creator's source code. It's a complex plugin based application.