aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/diveplannermodel.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-23 13:51:39 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commit35c5ec09b7a6365241c02faf89bf9cefc1a23bf5 (patch)
treeaaf5415c2fb4a3403cffdf96e4c99fb307c81afe /qt-models/diveplannermodel.cpp
parent1e525244e62f2997f69b6e006510b0f66222bae7 (diff)
downloadsubsurface-35c5ec09b7a6365241c02faf89bf9cefc1a23bf5.tar.gz
planner: insert point at correct position
Instead of inserting the point at the calculated position, the DivePlannerPointsModel would append it at the end and then resort the vector. That's just silly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/diveplannermodel.cpp')
-rw-r--r--qt-models/diveplannermodel.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 493188325..1099e6785 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -826,8 +826,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
point.entered = entered;
point.divemode = divemode;
point.next = NULL;
- divepoints.append(point);
- std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan);
+ divepoints.insert(divepoints.begin() + row, point);
endInsertRows();
return row;
}