How to make plugins configurable?
I have a
PluginManagerwhere searches for plugins in a folder, load using
QPluginLoaderputs in a
QHash<QString, QPluginLoader *>the
QStringhas the classname taken from the
PluginManagerhas a method called
initializePluginswhere has a
foreachgetting the instance of each plugin using
qobject_castand calling the method
initializeof the plugin.
The idea I want to implement? The plugins are websites, for example:
rapidgator.comand I need login and password information from the user.
I want to implement a kind of listing of the plugins found in a window, maybe in a configuration part of the system, maybe it could help, but I have no idea what I can do.
How to make plugins configurable? Each plugin can have configuration individually?
QSettingswill help me to save the settings, but that is not what I'm actually asking here, but how to ask for the user for the login and password, or another configuration.
I thought about creating a window with all the plugins listed and when you click or something like that the configurations for that plugin appears!?
I'm not worried about saving the configurations, but how to provide different configurations for different plugins where the user can specify then somewhere.
Make the configuration part of your plugin by e.g. making it provide a configuration widget.
@SGaist I know that it might be asking too much but can you provide an example? I can't find anything similar.
Well, it boils down to adding a method to your plugin interface called e.g.
virtual QWidget *configurationWidget() const = 0;and in your plugins, you reimplement it to return a QWidget based widget that provides a panel that allows to modify whatever plugin specific settings you may need.
@SGaist I'll try to implement something using this approach, thank you.