From 96cf2cbd05b87ca2163381f8ee9cbed15654ee27 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 79900c6c4c..a572ca6321 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 3e503a80cf..7492b6b17b 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);