diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 1aa08e7fae..5214df0a10 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -239,9 +239,12 @@ void PropertyView::slotAppendDynamicProperty(const App::Property& prop) return; App::PropertyContainer* parent = prop.getContainer(); - if (propertyEditorData->propOwners.contains(parent) - || propertyEditorView->propOwners.contains(parent)) - { + if (propertyEditorData->propOwners.contains(parent)) { + propertyEditorData->blockCollapseAll(); + timer->start(ViewParams::instance()->getPropertyViewTimer()); + } + if ( propertyEditorView->propOwners.contains(parent)) { + propertyEditorView->blockCollapseAll(); timer->start(ViewParams::instance()->getPropertyViewTimer()); } } diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 30c2354112..500ce3ccca 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -673,6 +673,11 @@ void Gui::PropertyEditor::PropertyEditor::drawRow(QPainter* painter, QTreeView::drawRow(painter, options, index); } +void PropertyEditor::blockCollapseAll() +{ + blockCollapse = true; +} + void PropertyEditor::buildUp(PropertyModel::PropertyList&& props, bool _checkDocument) { checkDocument = _checkDocument; @@ -724,7 +729,10 @@ void PropertyEditor::buildUp(PropertyModel::PropertyList&& props, bool _checkDoc expandAll(); break; case ExpansionMode::AutoCollapse: - collapseAll(); + if (!blockCollapse) { + collapseAll(); + } + blockCollapse = false; break; } } @@ -735,6 +743,7 @@ void PropertyEditor::updateProperty(const App::Property& prop) if (!committing) { propertyModel->updateProperty(prop); } + blockCollapseAll(); } void PropertyEditor::setEditorMode(const QModelIndex& parent, int start, int end) @@ -751,10 +760,9 @@ void PropertyEditor::setEditorMode(const QModelIndex& parent, int start, int end void PropertyEditor::removeProperty(const App::Property& prop) { - for (PropertyModel::PropertyList::iterator it = propList.begin(); it != propList.end(); ++it) { + for (auto it = propList.begin(); it != propList.end(); ++it) { // find the given property in the list and remove it if it's there - std::vector::iterator pos = - std::ranges::find(it->second, &prop); + auto pos = std::ranges::find(it->second, &prop); if (pos != it->second.end()) { it->second.erase(pos); // if the last property of this name is removed then also remove the whole group @@ -765,6 +773,7 @@ void PropertyEditor::removeProperty(const App::Property& prop) break; } } + blockCollapseAll(); } void PropertyEditor::renameProperty(const App::Property& prop) @@ -777,6 +786,7 @@ void PropertyEditor::renameProperty(const App::Property& prop) break; } } + blockCollapseAll(); } enum MenuAction diff --git a/src/Gui/propertyeditor/PropertyEditor.h b/src/Gui/propertyeditor/PropertyEditor.h index d326d71049..6fa535b5e2 100644 --- a/src/Gui/propertyeditor/PropertyEditor.h +++ b/src/Gui/propertyeditor/PropertyEditor.h @@ -83,6 +83,7 @@ public: /** Builds up the list view with the properties. */ void buildUp(PropertyModel::PropertyList&& props = PropertyModel::PropertyList(), bool checkDocument = false); + void blockCollapseAll(); void updateProperty(const App::Property&); void removeProperty(const App::Property&); void renameProperty(const App::Property&); @@ -161,6 +162,7 @@ private: bool autoupdate; bool committing; bool delaybuild; + bool blockCollapse; bool binding; bool checkDocument; bool closingEditor;