Adding configurations to plugins
-
Hi, I'm trying to create a software with support for plugins and I've been reading the examples that comes with Qt but none of them has a "way" to create "configurations" to plugins? I want each plugin to have different configurations.
You know I will probably list the plugins in a window, I don't know if it's better to add a gui configuration to each one or what, but I'm asking because I have no idea. -
@Defohin
since you write the plugins yourself you could add an interface method that returns the configuration.
For example this could be a JSON string, which specifies the options and it's types. Then the application creates the GUI according to it.
Or let the plugin return a QWidget* which contains has all configuration widgets already layed out. Then the application simply needs to embedd it in some of it's views.
You can use QSettings to store the set options locally on the machine. -
@Defohin
@raven-worx has the right approach. Plugins are very easy and can be part of your application in as abstract or integrated as you need.If you are want to let the plugin conatain and show the configuration UI, you can also just pass a pointer to your QSettings class and the pointer to your the parent to the plugin and it can create its own section. I, myself, have used a mixture. Especially if my settings is a book or tree-style interface. Then just add the UI widget!