mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 20:36:42 +00:00
Remove document when closing the last view. Should resolve Bug #1292.
This commit is contained in:
parent
ad8d722763
commit
84f5784575
3 changed files with 14 additions and 4 deletions
|
@ -24,6 +24,11 @@ void CSVDoc::View::closeEvent (QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if (!mViewManager.closeRequest (this))
|
if (!mViewManager.closeRequest (this))
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// closeRequest() returns true if last document
|
||||||
|
mViewManager.removeDocument(mDocument);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::View::setupFileMenu()
|
void CSVDoc::View::setupFileMenu()
|
||||||
|
|
|
@ -192,6 +192,12 @@ bool CSVDoc::ViewManager::closeRequest (View *view)
|
||||||
return continueWithClose;
|
return continueWithClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::ViewManager::removeDocument (CSMDoc::Document *document)
|
||||||
|
{
|
||||||
|
if(document)
|
||||||
|
mDocumentManager.removeDocument(document);
|
||||||
|
}
|
||||||
|
|
||||||
bool CSVDoc::ViewManager::notifySaveOnClose (CSVDoc::View *view)
|
bool CSVDoc::ViewManager::notifySaveOnClose (CSVDoc::View *view)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
@ -349,8 +355,7 @@ void CSVDoc::ViewManager::exitApplication (CSVDoc::View *view)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CSMDoc::Document * document = view->getDocument();
|
CSMDoc::Document * document = view->getDocument();
|
||||||
if(document)
|
removeDocument(document);
|
||||||
mDocumentManager.removeDocument(document);
|
|
||||||
view->setVisible(false);
|
view->setVisible(false);
|
||||||
|
|
||||||
// attempt to close all other documents
|
// attempt to close all other documents
|
||||||
|
@ -364,8 +369,7 @@ void CSVDoc::ViewManager::exitApplication (CSVDoc::View *view)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
document = mViews.back()->getDocument();
|
document = mViews.back()->getDocument();
|
||||||
if(document)
|
removeDocument(document);
|
||||||
mDocumentManager.removeDocument(document);
|
|
||||||
mViews.back()->setVisible(false);
|
mViews.back()->setVisible(false);
|
||||||
mViews.pop_back();
|
mViews.pop_back();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace CSVDoc
|
||||||
///< Return number of views for \a document.
|
///< Return number of views for \a document.
|
||||||
|
|
||||||
bool closeRequest (View *view);
|
bool closeRequest (View *view);
|
||||||
|
void removeDocument (CSMDoc::Document *document);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue