From da19c8489a25a50d531b0bbc7831e3ab8133cf53 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Mon, 30 Sep 2019 11:43:31 +0800 Subject: [PATCH] Gui: fix missing auto update when edit property expression It only happens when editing expression through property editor context menu action. --- src/Gui/propertyeditor/PropertyEditor.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 5ea7aa0b1c..0167c3cf32 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -155,6 +155,20 @@ void PropertyEditor::commitData (QWidget * editor) void PropertyEditor::editorDestroyed (QObject * editor) { QTreeView::editorDestroyed(editor); + + // When editing expression through context menu, the editor (ExpLineEditor) + // deletes itself when finished, so it won't trigger closeEditor signal. We + // must handle it here to perform auto update. + if (autoupdate) { + App::Document* doc = App::GetApplication().getActiveDocument(); + if (doc) { + if (!doc->isTransactionEmpty()) { + if (doc->isTouched()) + doc->recompute(); + } + } + App::GetApplication().closeActiveTransaction(); + } } void PropertyEditor::currentChanged ( const QModelIndex & current, const QModelIndex & previous ) @@ -561,6 +575,7 @@ void PropertyEditor::contextMenuEvent(QContextMenuEvent *) { closePersistentEditor(contextIndex); Base::FlagToggler<> flag(binding); edit(contextIndex,AllEditTriggers,0); + setupTransaction(contextIndex); } break; case MA_AddProp: {