forked from mirror/openmw-tes3mp
Issue a single dataChanged() when the modified column changes
This commit is contained in:
parent
d26b5a13ef
commit
1177e5ac79
1 changed files with 6 additions and 11 deletions
|
@ -84,7 +84,6 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value
|
|||
if (mIdCollection->getColumn (index.column()).isEditable() && role==Qt::EditRole)
|
||||
{
|
||||
mIdCollection->setData (index.row(), index.column(), value);
|
||||
emit dataChanged(index, index);
|
||||
|
||||
int stateColumn = searchColumnIndex(Columns::ColumnId_Modification);
|
||||
if (stateColumn != -1)
|
||||
|
@ -94,23 +93,19 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value
|
|||
// modifying the state column can modify other values. we need to tell
|
||||
// views that the whole row has changed.
|
||||
|
||||
int count = columnCount(index.parent());
|
||||
for (int i=0; i<count; ++i)
|
||||
{
|
||||
if (i != stateColumn) // we already notified about the state column itself
|
||||
{
|
||||
QModelIndex columnIndex = this->index(index.row(), i);
|
||||
emit dataChanged(columnIndex, columnIndex);
|
||||
}
|
||||
}
|
||||
emit dataChanged(this->index(index.row(), 0),
|
||||
this->index(index.row(), columnCount(index.parent())));
|
||||
|
||||
} else
|
||||
{
|
||||
emit dataChanged(index, index);
|
||||
|
||||
// Modifying a value can also change the Modified status of a record.
|
||||
QModelIndex stateIndex = this->index(index.row(), stateColumn);
|
||||
emit dataChanged(stateIndex, stateIndex);
|
||||
}
|
||||
}
|
||||
} else
|
||||
emit dataChanged(index, index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue