From 35c5ec09b7a6365241c02faf89bf9cefc1a23bf5 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 23 Jan 2021 13:51:39 +0100 Subject: 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 --- qt-models/diveplannermodel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'qt-models') 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; } -- cgit v1.2.3-70-g09d2