summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/locationinformation.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-04-13 18:54:41 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-15 11:23:11 +1200
commit826cc97921df3fae69c04dd7318ee7fb49033fca (patch)
treeb575903f29ee9d23f6683743ce36211f7916423a /desktop-widgets/locationinformation.cpp
parent606c3a02451cb41b984528cbf98ecd9a3f91401f (diff)
downloadsubsurface-826cc97921df3fae69c04dd7318ee7fb49033fca.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/locationinformation.cpp')
-rw-r--r--desktop-widgets/locationinformation.cpp3
1 files changed, 2 insertions, 1 deletions
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.