From d2c1266b7fd4aff3ce6feeed265c997a89bd0d34 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 10 Mar 2020 11:40:08 +0100 Subject: [PATCH] Gui: [skip ci] do not mark the document as modified if the visibility of an object changes but the flag 'TouchDocument' is not set --- src/Gui/ViewProviderDocumentObject.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Gui/ViewProviderDocumentObject.cpp b/src/Gui/ViewProviderDocumentObject.cpp index 0b993f2f7b..66cc0a3506 100644 --- a/src/Gui/ViewProviderDocumentObject.cpp +++ b/src/Gui/ViewProviderDocumentObject.cpp @@ -189,7 +189,18 @@ void ViewProviderDocumentObject::onChanged(const App::Property* prop) && getObject() && getObject()->Visibility.getValue()!=Visibility.getValue()) { - getObject()->Visibility.setValue(Visibility.getValue()); + // Changing the visibility of a document object will automatically set + // the document modified but if the 'TouchDocument' flag is not set then + // this is undesired behaviour. So, if this change marks the document as + // modified then it must be be reversed. + if (!testStatus(Gui::ViewStatus::TouchDocument)) { + bool mod = pcDocument->isModified(); + getObject()->Visibility.setValue(Visibility.getValue()); + pcDocument->setModified(mod); + } + else { + getObject()->Visibility.setValue(Visibility.getValue()); + } } } else if (prop == &SelectionStyle) {