Core: Fixed a bug where an empty document disappears (#20554)
* Core: Fixed a bug where an empty document disappears Created a flag named autoCreated to distinguish an autoCreated document created in the startup from a manually document. Implemented a setter and a getter for this new flag. Added a codition that verifies if a document is autoCreated when opening another document to close it in the correct case. Implemented unit tests for theses cases. Fixes #19868. Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt> * Tests: Fix failing auto-created document tests Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt> * Tests: moved created tests to the existing Document test framework. Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt> --------- Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>
This commit is contained in:
@@ -1564,6 +1564,9 @@ void MainWindow::delayedStartup()
|
||||
if (hGrp->GetBool("CreateNewDoc", false)) {
|
||||
if (App::GetApplication().getDocuments().empty()){
|
||||
Application::Instance->commandManager().runCommandByName("Std_New");
|
||||
// This document is autoCreated
|
||||
App::Document* newDoc = App::GetApplication().getActiveDocument();
|
||||
newDoc->setAutoCreated(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user