diff options
| author | AnyOldName3 <krizdjali+github@gmail.com> | 2018-05-02 17:10:38 +0100 |
|---|---|---|
| committer | AnyOldName3 <krizdjali+github@gmail.com> | 2018-05-02 17:10:38 +0100 |
| commit | 938d3ce91bd436e840684c0d633df71ef33fd4e0 (patch) | |
| tree | 5a2f84910ca8fa63dc8258a7aa348c6cf5fdfb70 /src | |
| parent | 3bb7a44610a770e3bd5525cfe2c129871864cb11 (diff) | |
Take a list of proxied plugins for each name to work around multiple inheritance issues
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugincontainer.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp index f6376496..8935c472 100644 --- a/src/plugincontainer.cpp +++ b/src/plugincontainer.cpp @@ -155,14 +155,18 @@ bool PluginContainer::registerPlugin(QObject *plugin, const QString &fileName) QCoreApplication::applicationDirPath() + "/" + ToQString(AppConfig::pluginPath()));
for (const QString &pluginName : pluginNames) {
try {
- QObject *proxiedPlugin = proxy->instantiate(pluginName);
- if (proxiedPlugin != nullptr) {
- if (registerPlugin(proxiedPlugin, pluginName)) {
- qDebug("loaded plugin \"%s\"", qPrintable(QFileInfo(pluginName).fileName()));
- } else {
- qWarning("plugin \"%s\" failed to load. If this plugin is for an older version of MO "
- "you have to update it or delete it if no update exists.",
- qPrintable(pluginName));
+ // we get a list of matching plugins as proxies don't necessarily have a good way of supporting multiple inheritance
+ QList<QObject*> matchingPlugins = proxy->instantiate(pluginName);
+ for (QObject *proxiedPlugin : matchingPlugins) {
+ if (proxiedPlugin != nullptr) {
+ if (registerPlugin(proxiedPlugin, pluginName)) {
+ qDebug("loaded plugin \"%s\"", qPrintable(QFileInfo(pluginName).fileName()));
+ }
+ else {
+ qWarning("plugin \"%s\" failed to load. If this plugin is for an older version of MO "
+ "you have to update it or delete it if no update exists.",
+ qPrintable(pluginName));
+ }
}
}
} catch (const std::exception &e) {
|
