From ce7cc797054059cb852cb9de9a30cd27af85db72 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 8 May 2020 11:43:22 +0200 Subject: desktop: hide/unhide tags if dive site was edited The tags of the dive site were shown/hidden when changing the current dive. Thus the following could happen: 1) User changes to dive with no tags. Tags are hidden. 2) User add image, which creates GPS tag 3) Tag is updated but not shown. Fix this by showing/hiding tags when they are calculated not when switching the dive. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/maintab.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'desktop-widgets/tab-widgets') diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 501afaa0c..9c08ddcbd 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -331,6 +331,11 @@ void MainTab::updateDiveSite(struct dive *d) ui.locationTags->clear(); ui.editDiveSiteButton->setEnabled(false); } + + if (ui.locationTags->text().isEmpty()) + ui.locationTags->hide(); + else + ui.locationTags->show(); } void MainTab::updateDiveInfo() @@ -444,10 +449,6 @@ void MainTab::updateDiveInfo() ui.duration->setText(render_seconds_to_string(current_dive->duration.seconds)); ui.depth->setText(get_depth_string(current_dive->maxdepth, true)); - if(ui.locationTags->text().isEmpty()) - ui.locationTags->hide(); - else - ui.locationTags->show(); ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty()); /* unset the special value text for date and time, just in case someone dove at midnight */ ui.dateEdit->setSpecialValueText(QString()); -- cgit v1.2.3-70-g09d2