How to make plugins configurable?



  • I have a PluginManager where searches for plugins in a folder, load using QPluginLoader puts in a QHash<QString, QPluginLoader *> the QString has the classname taken from the QPluginLoader::metaData.
    The PluginManager has a method called initializePlugins where has a foreach getting the instance of each plugin using qobject_cast and calling the method initialize 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?


  • Moderators



  • @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.


  • Lifetime Qt Champion

    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.


  • Lifetime Qt Champion

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.