From 826cc97921df3fae69c04dd7318ee7fb49033fca Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 13 Apr 2019 18:54:41 +0200 Subject: Dive site: display proper text for the two special options The dive-site line edit box features two special entries for adding new dive sites. These should display different texts depending on whether the current dive has a dive site or not. The current check is wrong, because it used displayed_dive, but since the last set of undo-changes, this might not be filled out correctly anymore. Instead the code should check the actual current dive. Signed-off-by: Berthold Stoeger --- desktop-widgets/locationinformation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index d935c4145..74dfb3e64 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -299,12 +299,13 @@ QVariant DiveLocationModel::data(const QModelIndex &index, int role) const case Qt::DisplayRole: return new_ds_value[index.row()]; case Qt::ToolTipRole: - return displayed_dive.dive_site ? + return current_dive && current_dive->dive_site ? tr("Create a new dive site, copying relevant information from the current dive.") : tr("Create a new dive site with this name"); case Qt::DecorationRole: return plusIcon; } + return QVariant(); } // The dive sites are -2 because of the first two items. -- cgit v1.2.3-70-g09d2