From 4780f1b2bdbe0559532bce98699c7c474c2b0d48 Mon Sep 17 00:00:00 2001 From: Doc West Date: Wed, 4 Jul 2018 22:37:10 +0200 Subject: [PATCH] Notify views of changes of all cells in a row to properly update the row after revert --- apps/opencs/model/world/commands.cpp | 9 +++++++++ apps/opencs/model/world/idtable.cpp | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/world/commands.cpp b/apps/opencs/model/world/commands.cpp index 79900c6c4..a572ca632 100644 --- a/apps/opencs/model/world/commands.cpp +++ b/apps/opencs/model/world/commands.cpp @@ -319,6 +319,15 @@ void CSMWorld::RevertCommand::redo() } else { + // notify view that data has changed, previously only the modified column was + // updated in the view unless the user had selected another item or forced a + // repaint with other means + int count = mModel.columnCount (index.parent ()); + if (count > 0) + { + emit mModel.dataChanged(mModel.index (index.row(), 0, index.parent ()), + mModel.index (index.row(), count - 1, index.parent ())); + } mModel.setData (index, static_cast (RecordBase::State_BaseOnly)); } } diff --git a/apps/opencs/model/world/idtable.cpp b/apps/opencs/model/world/idtable.cpp index 3e503a80c..7492b6b17 100644 --- a/apps/opencs/model/world/idtable.cpp +++ b/apps/opencs/model/world/idtable.cpp @@ -86,9 +86,9 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value mIdCollection->setData (index.row(), index.column(), value); emit dataChanged(index, index); - // Modifying a value can also change the Modified status of a record. + // Modifying a value can also change the Modified status of a record unless . int stateColumn = searchColumnIndex(Columns::ColumnId_Modification); - if (stateColumn != -1) + if (stateColumn != -1 && index.column() != stateColumn) { QModelIndex stateIndex = this->index(index.row(), stateColumn); emit dataChanged(stateIndex, stateIndex);