From 65ab2369488a2526fbadd156ef92ab4fd1d1d04a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 26 Aug 2013 17:15:48 -0300 Subject: [PATCH] Fixed moving a dive point between dive points Fixed moving a dive point between dive points. this fixes mostly everything that I have broked by using a Qt Model instead of a linked list - but a model is better to make everything updated and only poke in one place. sharing code++. :) Signed-off-by: Tomaz Canabrava --- qt-ui/diveplanner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 4752a9f2b..00e522602 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -988,7 +988,8 @@ int DivePlannerPointsModel::addStop(int meters, int minutes, const QString& gas, void DivePlannerPointsModel::editStop(int row, divedatapoint newData) { divepoints[row] = newData; - emit dataChanged(createIndex(row, 0), createIndex(row, COLUMNS-1)); + std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan); + emit dataChanged(createIndex(0, 0), createIndex(rowCount()-1, COLUMNS-1)); } divedatapoint DivePlannerPointsModel::at(int row)