mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-26 02:38:04 +00:00
make preview watch for changes in modification state of relevant records
This commit is contained in:
parent
a2f514f024
commit
6020edf60f
@ -39,6 +39,18 @@ void CSVRender::PreviewWidget::referenceableDataChanged (const QModelIndex& topL
|
||||
{
|
||||
if (mObject.referenceableDataChanged (topLeft, bottomRight))
|
||||
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,
|
||||
@ -77,6 +89,18 @@ void CSVRender::PreviewWidget::referenceDataChanged (const QModelIndex& topLeft,
|
||||
CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
|
||||
*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);
|
||||
|
||||
QModelIndex index = references.getModelIndex (mObject.getReferenceId(), columnIndex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user