diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 38ae649fc3c704460f83fc7508652ac271e83a0f..f8dec1b73c14c9fae54196969e243f0ab82a1489 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -781,11 +781,17 @@ void QGCToolBar::connectLink(bool connect) link->setPortName(portComboBox->itemData(portComboBox->currentIndex()).toString().trimmed()); int baud = baudcomboBox->currentText().toInt(); link->setBaudRate(baud); + QObject::connect(link, SIGNAL(connected(bool)), this, SLOT(updateLinkState(bool))); link->connect(); } } else if (!connect && currentLink) { currentLink->disconnect(); + QObject::disconnect(currentLink, SIGNAL(connected(bool)), this, SLOT(updateLinkState(bool))); + } + + if (currentLink) { + updateLinkState(currentLink->isConnected()); } }