summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divetripmodel.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index bc64ef211..d8166d2eb 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -759,6 +759,11 @@ void DiveTripModelTree::topLevelChanged(int idx)
endMoveRows();
}
+ // If we moved the object backwards in the array, we have to
+ // subtract one from the index to account for the removed object.
+ if (newIdx > idx)
+ --newIdx;
+
// Finally, inform UI of changed trip header
QModelIndex tripIdx = createIndex(newIdx, 0, noParent);
dataChanged(tripIdx, tripIdx);