Unsolved How to make plugins configurable?
-
I have a
PluginManager
where searches for plugins in a folder, load usingQPluginLoader
puts in aQHash<QString, QPluginLoader *>
theQString
has the classname taken from theQPluginLoader::metaData
.
ThePluginManager
has a method calledinitializePlugins
where has aforeach
getting the instance of each plugin usingqobject_cast
and calling the methodinitialize
of the plugin.The idea I want to implement? The plugins are websites, for example:
rapidgator.com
and 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? -
@Defohin What about http://doc.qt.io/qt-5/qsettings.html ?
-
@jsulm
QSettings
will 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. -
Hi,
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.