aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-10 16:29:14 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-10 16:32:10 -0800
commit829473ddc64e50169fbc177c6ee5ce2bf702a3ed (patch)
tree13bfacd326c383d41ecd206b951e3eef79e902c4
parentba6713f0d89e5e5a8f882ca946227fdfd4154447 (diff)
downloadsubsurface-829473ddc64e50169fbc177c6ee5ce2bf702a3ed.tar.gz
Don't repopulate the model if the dive didn't change
plotDives takes a list of dives (for future use) but currently only looks at the first dive in this list. With that semantic in mind we can save ourselves some work if we first check if this is the same dive we are already showing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/profilewidget2.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index d53dfba5b..42b8a6ef1 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -272,6 +272,14 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
if (!d)
return;
+ // No need to do this again if we are already showing that dive,
+ // so we check the unique id of the dive against the one we are
+ // showing (can't compare the dive pointers as those might change).
+ // I'm unclear what the semantics are supposed to be if we actually
+ // use more than one 'dives' as argument - so ignoring that right now :-)
+ if (d->id == dataModel->id())
+ return;
+
setProfileState();
// Here we need to probe for the limits of the dive.
// There's already a function that does exactly that,