App/Gui: introduce temporary document

Add new argument to Application::newDocument() to create a temporary
    document. Also exposed to Python API App.newDocument() with a named
    argument 'temp'.

    The temporary document is marked with status bit 'TempDoc'. The user
    will not be prompt for saving when closing. The undo/redo is disabled.
    The AutoSaver skips it. And the tree view will not show it.
    PropertyXLink allows linking to/from object within a temporary document
    without saving.
This commit is contained in:
Zheng, Lei
2020-01-03 20:36:54 +08:00
committed by wmayer
parent 20cb8e2480
commit 36d046d489
13 changed files with 119 additions and 46 deletions

View File

@@ -2147,6 +2147,8 @@ void TreeWidget::drawRow(QPainter *painter, const QStyleOptionViewItem &options,
void TreeWidget::slotNewDocument(const Gui::Document& Doc, bool isMainDoc)
{
if(Doc.getDocument()->testStatus(App::Document::TempDoc))
return;
DocumentItem* item = new DocumentItem(&Doc, this->rootItem);
if(isMainDoc)
this->expandItem(item);