Issue a single dataChanged() when the modified column changes

remotes/1728160796594174844/tmp_0.7.0-alpha
Alexander Stillich 7 years ago
parent b8e53b5b81
commit 78a5799911

@ -84,7 +84,6 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value
if (mIdCollection->getColumn (index.column()).isEditable() && role==Qt::EditRole) if (mIdCollection->getColumn (index.column()).isEditable() && role==Qt::EditRole)
{ {
mIdCollection->setData (index.row(), index.column(), value); mIdCollection->setData (index.row(), index.column(), value);
emit dataChanged(index, index);
int stateColumn = searchColumnIndex(Columns::ColumnId_Modification); int stateColumn = searchColumnIndex(Columns::ColumnId_Modification);
if (stateColumn != -1) 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 // modifying the state column can modify other values. we need to tell
// views that the whole row has changed. // views that the whole row has changed.
int count = columnCount(index.parent()); emit dataChanged(this->index(index.row(), 0),
for (int i=0; i<count; ++i) this->index(index.row(), columnCount(index.parent())));
{
if (i != stateColumn) // we already notified about the state column itself
{
QModelIndex columnIndex = this->index(index.row(), i);
emit dataChanged(columnIndex, columnIndex);
}
}
} else } else
{ {
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.
QModelIndex stateIndex = this->index(index.row(), stateColumn); QModelIndex stateIndex = this->index(index.row(), stateColumn);
emit dataChanged(stateIndex, stateIndex); emit dataChanged(stateIndex, stateIndex);
} }
} } else
emit dataChanged(index, index);
return true; return true;
} }

Loading…
Cancel
Save