From 8cdc7f9f591a5339b7f9c1a54d03e57169495714 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 29 Dec 2016 09:39:52 -0800 Subject: [PATCH] Fix Qml API --- src/comm/LinkManager.cc | 10 ++++++++++ src/comm/LinkManager.h | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index 9e999ced5..dc6c49652 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -99,6 +99,16 @@ void LinkManager::setToolbox(QGCToolbox *toolbox) } +// This should only be used by Qml code +void LinkManager::createConnectedLink(LinkConfiguration* config) +{ + for(int i = 0; i < _sharedConfigurations.count(); i++) { + SharedLinkConfigurationPointer& sharedConf = _sharedConfigurations[i]; + if (sharedConf->name() == config->name()) + createConnectedLink(sharedConf); + } +} + LinkInterface* LinkManager::createConnectedLink(SharedLinkConfigurationPointer& config) { if (!config) { diff --git a/src/comm/LinkManager.h b/src/comm/LinkManager.h index f75fc50f1..9383c38a0 100644 --- a/src/comm/LinkManager.h +++ b/src/comm/LinkManager.h @@ -124,7 +124,10 @@ public: /// Creates, connects (and adds) a link based on the given configuration instance. /// Link takes ownership of config. - Q_INVOKABLE LinkInterface* createConnectedLink(SharedLinkConfigurationPointer& config); + LinkInterface* createConnectedLink(SharedLinkConfigurationPointer& config); + + // This should only be used by Qml code + Q_INVOKABLE void createConnectedLink(LinkConfiguration* config); /// Creates, connects (and adds) a link based on the given configuration name. LinkInterface* createConnectedLink(const QString& name); -- 2.22.0