1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 12:35:46 +00:00

Inform about Modified status change when modifying a value of a model

This commit is contained in:
Stanislav Bas 2015-08-02 15:06:56 +03:00
parent afb36b73eb
commit 25b653e316
2 changed files with 12 additions and 2 deletions

View File

@ -77,7 +77,11 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value
{ {
mIdCollection->setData (index.row(), index.column(), value); mIdCollection->setData (index.row(), index.column(), value);
emit dataChanged (index, index); // Modifying a value can also change the Modified status of a record.
// To track this, we inform about the change of a whole row.
QModelIndex rowStart = this->index(index.row(), 0);
QModelIndex rowEnd = this->index(index.row(), columnCount(index.parent()) - 1);
emit dataChanged(rowStart, rowEnd);
return true; return true;
} }

View File

@ -98,6 +98,12 @@ bool CSMWorld::IdTree::setData (const QModelIndex &index, const QVariant &value,
emit dataChanged(index, index); emit dataChanged(index, index);
// Modifying a value can also change the Modified status of a record (located in the parent row).
// To track this, we inform about the change of a whole parent row.
QModelIndex parentRowStart = this->index(index.parent().row(), 0);
QModelIndex parentRowEnd = this->index(index.parent().row(), columnCount(index.parent()) - 1);
emit dataChanged(parentRowStart, parentRowEnd);
return true; return true;
} }
else else