mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 16:19:41 +00:00
Inform about State change (not a whole row) when modifying a table value
This commit is contained in:
parent
4d24eff859
commit
720aca8f3d
2 changed files with 14 additions and 10 deletions
|
@ -76,12 +76,15 @@ 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);
|
||||||
|
|
||||||
// Modifying a value can also change the Modified status of a record.
|
// Modifying a value can also change the Modified status of a record.
|
||||||
// To track this, we inform about the change of a whole row.
|
int stateColumn = searchColumnIndex(Columns::ColumnId_Modification);
|
||||||
QModelIndex rowStart = this->index(index.row(), 0);
|
if (stateColumn != -1)
|
||||||
QModelIndex rowEnd = this->index(index.row(), columnCount(index.parent()) - 1);
|
{
|
||||||
emit dataChanged(rowStart, rowEnd);
|
QModelIndex stateIndex = this->index(index.row(), stateColumn);
|
||||||
|
emit dataChanged(stateIndex, stateIndex);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,14 +95,15 @@ bool CSMWorld::IdTree::setData (const QModelIndex &index, const QVariant &value,
|
||||||
const std::pair<int, int>& parentAddress(unfoldIndexAddress(index.internalId()));
|
const std::pair<int, int>& parentAddress(unfoldIndexAddress(index.internalId()));
|
||||||
|
|
||||||
mNestedCollection->setNestedData(parentAddress.first, parentAddress.second, value, index.row(), index.column());
|
mNestedCollection->setNestedData(parentAddress.first, parentAddress.second, value, index.row(), index.column());
|
||||||
|
|
||||||
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).
|
// Modifying a value can also change the Modified status of a record.
|
||||||
// To track this, we inform about the change of a whole parent row.
|
int stateColumn = searchColumnIndex(Columns::ColumnId_Modification);
|
||||||
QModelIndex parentRowStart = this->index(index.parent().row(), 0);
|
if (stateColumn != -1)
|
||||||
QModelIndex parentRowEnd = this->index(index.parent().row(), columnCount(index.parent()) - 1);
|
{
|
||||||
emit dataChanged(parentRowStart, parentRowEnd);
|
QModelIndex stateIndex = this->index(index.parent().row(), stateColumn);
|
||||||
|
emit dataChanged(stateIndex, stateIndex);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue