mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 17:06:43 +00:00
update/close on deletion of reference/referenceable
This commit is contained in:
parent
698fe8cce3
commit
1e57d55717
1 changed files with 36 additions and 0 deletions
|
@ -110,6 +110,9 @@ CSVRender::PreviewWidget::PreviewWidget (CSMWorld::Data& data,
|
||||||
void CSVRender::PreviewWidget::ReferenceableDataChanged (const QModelIndex& topLeft,
|
void CSVRender::PreviewWidget::ReferenceableDataChanged (const QModelIndex& topLeft,
|
||||||
const QModelIndex& bottomRight)
|
const QModelIndex& bottomRight)
|
||||||
{
|
{
|
||||||
|
if (mReferenceableId.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
CSMWorld::IdTable& referenceables = dynamic_cast<CSMWorld::IdTable&> (
|
CSMWorld::IdTable& referenceables = dynamic_cast<CSMWorld::IdTable&> (
|
||||||
*mData.getTableModel (CSMWorld::UniversalId::Type_Referenceables));
|
*mData.getTableModel (CSMWorld::UniversalId::Type_Referenceables));
|
||||||
|
|
||||||
|
@ -127,12 +130,36 @@ void CSVRender::PreviewWidget::ReferenceableDataChanged (const QModelIndex& topL
|
||||||
void CSVRender::PreviewWidget::ReferenceableAboutToBeRemoved (const QModelIndex& parent, int start,
|
void CSVRender::PreviewWidget::ReferenceableAboutToBeRemoved (const QModelIndex& parent, int start,
|
||||||
int end)
|
int end)
|
||||||
{
|
{
|
||||||
|
if (mReferenceableId.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CSMWorld::IdTable& referenceables = dynamic_cast<CSMWorld::IdTable&> (
|
||||||
|
*mData.getTableModel (CSMWorld::UniversalId::Type_Referenceables));
|
||||||
|
|
||||||
|
QModelIndex index = referenceables.getModelIndex (mReferenceableId, 0);
|
||||||
|
|
||||||
|
if (index.row()>=start && index.row()<=end)
|
||||||
|
{
|
||||||
|
if (mReferenceId.empty())
|
||||||
|
{
|
||||||
|
// this is a preview for a referenceble
|
||||||
|
emit closeRequest();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// this is a preview for a reference
|
||||||
|
mObject.setNull();
|
||||||
|
flagAsModified();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::PreviewWidget::ReferenceDataChanged (const QModelIndex& topLeft,
|
void CSVRender::PreviewWidget::ReferenceDataChanged (const QModelIndex& topLeft,
|
||||||
const QModelIndex& bottomRight)
|
const QModelIndex& bottomRight)
|
||||||
{
|
{
|
||||||
|
if (mReferenceId.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
@ -160,5 +187,14 @@ void CSVRender::PreviewWidget::ReferenceDataChanged (const QModelIndex& topLeft,
|
||||||
void CSVRender::PreviewWidget::ReferenceAboutToBeRemoved (const QModelIndex& parent, int start,
|
void CSVRender::PreviewWidget::ReferenceAboutToBeRemoved (const QModelIndex& parent, int start,
|
||||||
int end)
|
int end)
|
||||||
{
|
{
|
||||||
|
if (mReferenceId.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
|
||||||
|
*mData.getTableModel (CSMWorld::UniversalId::Type_References));
|
||||||
|
|
||||||
|
QModelIndex index = references.getModelIndex (mReferenceId, 0);
|
||||||
|
|
||||||
|
if (index.row()>=start && index.row()<=end)
|
||||||
|
emit closeRequest();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue