close interior cell view when cell is deleted

This commit is contained in:
Marc Zinnschlag 2014-03-06 16:40:08 +01:00
parent 0254a209f6
commit 516a3b9abd
4 changed files with 29 additions and 8 deletions

View file

@ -38,13 +38,21 @@ CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string&
void CSVRender::UnpagedWorldspaceWidget::cellDataChanged (const QModelIndex& topLeft, void CSVRender::UnpagedWorldspaceWidget::cellDataChanged (const QModelIndex& topLeft,
const QModelIndex& bottomRight) const QModelIndex& bottomRight)
{ {
QModelIndex cellIndex = mCellsModel->getModelIndex (mCellId, 0); int index = mCellsModel->findColumnIndex (CSMWorld::Columns::ColumnId_Modification);
QModelIndex cellIndex = mCellsModel->getModelIndex (mCellId, index);
if (cellIndex.row()>=topLeft.row() && cellIndex.row()<bottomRight.row()) if (cellIndex.row()>=topLeft.row() && cellIndex.row()<=bottomRight.row())
{ {
/// \todo possible optimisation: check columns and update only if relevant columns have if (mCellsModel->data (cellIndex).toInt()==CSMWorld::RecordBase::State_Deleted)
/// changed {
update(); emit closeRequest();
}
else
{
/// \todo possible optimisation: check columns and update only if relevant columns have
/// changed
update();
}
} }
} }
@ -54,7 +62,5 @@ void CSVRender::UnpagedWorldspaceWidget::cellRowsAboutToBeRemoved (const QModelI
QModelIndex cellIndex = mCellsModel->getModelIndex (mCellId, 0); QModelIndex cellIndex = mCellsModel->getModelIndex (mCellId, 0);
if (cellIndex.row()>=start && cellIndex.row()<=end) if (cellIndex.row()>=start && cellIndex.row()<=end)
{ emit closeRequest();
}
} }

View file

@ -36,6 +36,10 @@ namespace CSVRender
private slots: private slots:
void selectNavigationMode (const std::string& mode); void selectNavigationMode (const std::string& mode);
signals:
void closeRequest();
}; };
} }

View file

@ -59,6 +59,8 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
setWidget (widget); setWidget (widget);
mScene->selectDefaultNavigationMode(); mScene->selectDefaultNavigationMode();
connect (mScene, SIGNAL (closeRequest()), this, SLOT (closeRequest()));
} }
void CSVWorld::SceneSubView::setEditLock (bool locked) void CSVWorld::SceneSubView::setEditLock (bool locked)
@ -77,3 +79,8 @@ void CSVWorld::SceneSubView::setStatusBar (bool show)
{ {
mBottom->setStatusBar (show); mBottom->setStatusBar (show);
} }
void CSVWorld::SceneSubView::closeRequest()
{
deleteLater();
}

View file

@ -37,6 +37,10 @@ namespace CSVWorld
virtual void updateEditorSetting (const QString& key, const QString& value); virtual void updateEditorSetting (const QString& key, const QString& value);
virtual void setStatusBar (bool show); virtual void setStatusBar (bool show);
private slots:
void closeRequest();
}; };
} }