From 006a0ebb39cb4f78fb62b9f4b83efe1e5a76ad4c Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Tue, 28 Nov 2017 20:55:50 +0100 Subject: [PATCH] Don't change visibility of depth and duration UI field when no dive After one selected a dive and then selects NO dive don't touch the visibility of UI fields for depth and duration. So if previously selected dive was a manually added dive, keep them visible. If it was no manually added dive keep them invisible. Signed-off-by: Stefan Fuchs --- desktop-widgets/tab-widgets/maintab.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 0a57fd4e8..b41f112e8 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -549,11 +549,13 @@ void MainTab::updateDiveInfo(bool clear) weightModel->updateDive(); taglist_get_tagstring(displayed_dive.tag_list, buf, 1024); ui.tagWidget->setText(QString(buf)); - bool isManual = !current_dive || same_string(current_dive->dc.model, "manually added dive"); - ui.depth->setVisible(isManual); - ui.depthLabel->setVisible(isManual); - ui.duration->setVisible(isManual); - ui.durationLabel->setVisible(isManual); + if (current_dive) { + bool isManual = same_string(current_dive->dc.model, "manually added dive"); + ui.depth->setVisible(isManual); + ui.depthLabel->setVisible(isManual); + ui.duration->setVisible(isManual); + ui.durationLabel->setVisible(isManual); + } } ui.duration->setText(QDateTime::fromTime_t(displayed_dive.duration.seconds).toUTC().toString("h:mm")); ui.depth->setText(get_depth_string(displayed_dive.maxdepth, true));