diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 7ed5c5548586738cc1d52fac3b64a534ca9d6375..99e1425d9a0048ba61412ef9d7e6ac8173cbe128 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -78,6 +78,7 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms) toolBarTimeoutLabel->setText(tr("CONNECTION LOST: %1 s").arg((ms / 1000.0f), 2, 'f', 1, ' ')); toolBarTimeoutAction->setVisible(true); toolBarMessageAction->setVisible(false); + toolBarBatteryBarAction->setVisible(false); } else { @@ -86,6 +87,7 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms) { toolBarTimeoutAction->setVisible(false); toolBarMessageAction->setVisible(true); + toolBarBatteryBarAction->setVisible(true); } } } @@ -136,13 +138,13 @@ void QGCToolBar::createUI() toolBarBatteryBar->setToolTip(tr("Battery charge level")); toolBarBatteryBar->setObjectName("toolBarBatteryBar"); toolBarBatteryBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - addWidget(toolBarBatteryBar); + toolBarBatteryBarAction = addWidget(toolBarBatteryBar); toolBarBatteryVoltageLabel = new QLabel(this); toolBarBatteryVoltageLabel->setToolTip(tr("Battery voltage")); toolBarBatteryVoltageLabel->setObjectName("toolBarBatteryVoltageLabel"); toolBarBatteryVoltageLabel->setAlignment(Qt::AlignCenter); - addWidget(toolBarBatteryVoltageLabel); + toolBarBatteryVoltageAction = addWidget(toolBarBatteryVoltageLabel); toolBarWpLabel = new QLabel(this); toolBarWpLabel->setToolTip(tr("Current waypoint")); diff --git a/src/ui/QGCToolBar.h b/src/ui/QGCToolBar.h index e31d1731f5f06a5ad9487af4b4070c4cc066d3e8..e161bcc9d887ae699da0a75f7e60ac7593efe0d9 100644 --- a/src/ui/QGCToolBar.h +++ b/src/ui/QGCToolBar.h @@ -113,6 +113,8 @@ protected: QAction* toolBarPortAction; QAction* toolBarBaudAction; QAction* toolBarWpAction; + QAction* toolBarBatteryBarAction; + QAction* toolBarBatteryVoltageAction; QLabel* toolBarSafetyLabel; QLabel* toolBarModeLabel; QLabel* toolBarStateLabel;