Commit 043c0270 authored by Victor Yacovlev's avatar Victor Yacovlev

PluginManager: Added function to find a plugin by interface

parent 7ef64df4
......@@ -80,6 +80,19 @@ public:
/** Module to start */
KPlugin * startupModule();
template <class PluginInterface>
PluginInterface* findPlugin() {
QList<KPlugin*> plugins = loadedPlugins();
PluginInterface* result = nullptr;
for (int i=0; i<plugins.size(); i++) {
KPlugin * plugin = plugins[i];
result = qobject_cast<PluginInterface*>(plugin);
if (result)
break;
}
return result;
}
public slots:
/** Show settings for all modules
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment