mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
make preview watch for changes in modification state of relevant records
This commit is contained in:
parent
a2f514f024
commit
6020edf60f
1 changed files with 24 additions and 0 deletions
|
@ -39,6 +39,18 @@ void CSVRender::PreviewWidget::referenceableDataChanged (const QModelIndex& topL
|
||||||
{
|
{
|
||||||
if (mObject.referenceableDataChanged (topLeft, bottomRight))
|
if (mObject.referenceableDataChanged (topLeft, bottomRight))
|
||||||
flagAsModified();
|
flagAsModified();
|
||||||
|
|
||||||
|
if (mObject.getReferenceId().empty())
|
||||||
|
{
|
||||||
|
CSMWorld::IdTable& referenceables = dynamic_cast<CSMWorld::IdTable&> (
|
||||||
|
*mData.getTableModel (CSMWorld::UniversalId::Type_Referenceables));
|
||||||
|
|
||||||
|
QModelIndex index = referenceables.getModelIndex (mObject.getReferenceableId(),
|
||||||
|
referenceables.findColumnIndex (CSMWorld::Columns::ColumnId_Modification));
|
||||||
|
|
||||||
|
if (referenceables.data (index).toInt()==CSMWorld::RecordBase::State_Deleted)
|
||||||
|
emit closeRequest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::PreviewWidget::referenceableAboutToBeRemoved (const QModelIndex& parent, int start,
|
void CSVRender::PreviewWidget::referenceableAboutToBeRemoved (const QModelIndex& parent, int start,
|
||||||
|
@ -77,6 +89,18 @@ void CSVRender::PreviewWidget::referenceDataChanged (const QModelIndex& topLeft,
|
||||||
CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
|
CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
|
||||||
*mData.getTableModel (CSMWorld::UniversalId::Type_References));
|
*mData.getTableModel (CSMWorld::UniversalId::Type_References));
|
||||||
|
|
||||||
|
// check for deleted state
|
||||||
|
{
|
||||||
|
QModelIndex index = references.getModelIndex (mObject.getReferenceId(),
|
||||||
|
references.findColumnIndex (CSMWorld::Columns::ColumnId_Modification));
|
||||||
|
|
||||||
|
if (references.data (index).toInt()==CSMWorld::RecordBase::State_Deleted)
|
||||||
|
{
|
||||||
|
emit closeRequest();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int columnIndex = references.findColumnIndex (CSMWorld::Columns::ColumnId_ReferenceableId);
|
int columnIndex = references.findColumnIndex (CSMWorld::Columns::ColumnId_ReferenceableId);
|
||||||
|
|
||||||
QModelIndex index = references.getModelIndex (mObject.getReferenceId(), columnIndex);
|
QModelIndex index = references.getModelIndex (mObject.getReferenceId(), columnIndex);
|
||||||
|
|
Loading…
Reference in a new issue