mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Close DialogueSubView if the corresponding record is deleted. Should resolve Bug #2575.
- ToDo: Doesn't seem to shrink the widget width properly (when horizontal scrollbar is active)
This commit is contained in:
parent
53b4c15d85
commit
22420c3a83
2 changed files with 21 additions and 0 deletions
|
@ -578,6 +578,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
||||||
mCommandDispatcher (document, CSMWorld::UniversalId::getParentType (id.getType()))
|
mCommandDispatcher (document, CSMWorld::UniversalId::getParentType (id.getType()))
|
||||||
{
|
{
|
||||||
connect(mTable, SIGNAL(dataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT(dataChanged(const QModelIndex&)));
|
connect(mTable, SIGNAL(dataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT(dataChanged(const QModelIndex&)));
|
||||||
|
connect(mTable, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), this, SLOT(rowsAboutToBeRemoved(const QModelIndex&, int, int)));
|
||||||
|
|
||||||
changeCurrentId(id.getId());
|
changeCurrentId(id.getId());
|
||||||
|
|
||||||
|
@ -740,6 +741,9 @@ void CSVWorld::DialogueSubView::nextId ()
|
||||||
|
|
||||||
void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
||||||
{
|
{
|
||||||
|
if (!mEditWidget) // hack to indicate that mCurrentId is no longer valid
|
||||||
|
return;
|
||||||
|
|
||||||
mLocked = locked;
|
mLocked = locked;
|
||||||
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
||||||
|
|
||||||
|
@ -766,6 +770,21 @@ void CSVWorld::DialogueSubView::dataChanged (const QModelIndex & index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::DialogueSubView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
||||||
|
{
|
||||||
|
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
||||||
|
|
||||||
|
if (currentIndex.isValid() && currentIndex.row() >= start && currentIndex.row() <= end)
|
||||||
|
{
|
||||||
|
if(mEditWidget)
|
||||||
|
{
|
||||||
|
delete mEditWidget;
|
||||||
|
mEditWidget = 0;
|
||||||
|
}
|
||||||
|
emit closeRequest(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::DialogueSubView::tableMimeDataDropped (QWidget* editor,
|
void CSVWorld::DialogueSubView::tableMimeDataDropped (QWidget* editor,
|
||||||
const QModelIndex& index,
|
const QModelIndex& index,
|
||||||
const CSMWorld::UniversalId& id,
|
const CSMWorld::UniversalId& id,
|
||||||
|
|
|
@ -235,6 +235,8 @@ namespace CSVWorld
|
||||||
const CSMDoc::Document* document);
|
const CSMDoc::Document* document);
|
||||||
|
|
||||||
void requestFocus (const std::string& id);
|
void requestFocus (const std::string& id);
|
||||||
|
|
||||||
|
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue