From ded8862e9dc3c45f2d89e9c4cb8fbff63f2e8c7a Mon Sep 17 00:00:00 2001 From: Aesylwinn Date: Thu, 26 May 2016 22:44:02 -0400 Subject: [PATCH] Insert nested rows after selected row, or at start if none selected. --- apps/opencs/view/world/nestedtable.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/world/nestedtable.cpp b/apps/opencs/view/world/nestedtable.cpp index 23d566439..0ccb88ce5 100644 --- a/apps/opencs/view/world/nestedtable.cpp +++ b/apps/opencs/view/world/nestedtable.cpp @@ -119,9 +119,14 @@ void CSVWorld::NestedTable::removeRowActionTriggered() void CSVWorld::NestedTable::addNewRowActionTriggered() { + int row = 0; + + if (!selectionModel()->selectedRows().empty()) + row = selectionModel()->selectedRows().back().row() + 1; + mDocument.getUndoStack().push(new CSMWorld::AddNestedCommand(*(mModel->model()), mModel->getParentId(), - selectionModel()->selectedRows().size(), + row, mModel->getParentColumn())); }