diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2018-05-02 14:01:50 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-02 14:01:50 -0500 |
| commit | 5555a58f8454063e66dd9a29449fcb19f73a0687 (patch) | |
| tree | edfc65d651b5fef8ef0639c6389c8e7b61d3cc07 /src/plugincontainer.cpp | |
| parent | 6588a81b7f52e94c4fca4a7378ca13307d51b58e (diff) | |
| parent | 4245036f524121aa113a44e02b2893bc08fb3d31 (diff) | |
Merge pull request #335 from AnyOldName3/proxy-multiple-inheritance-support
Proxy multiple inheritance support
Diffstat (limited to 'src/plugincontainer.cpp')
| -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) {
|
