Assembly: prevent assembly collapse when editing sketch. (#26956)

* Gui: View provider: isAutoCollapseOnDeactivation

* Update ViewProvider.h

* Update ActiveObjectList.cpp

* Update ViewProviderAssembly.cpp

* Update ActiveObjectList.cpp

(cherry picked from commit abc5f90466)
This commit is contained in:
PaddleStroke
2026-01-23 18:13:04 +01:00
committed by Max Wilfinger
parent 202edb75d7
commit 97ed11358b
3 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ void ActiveObjectList::setHighlight(const ObjectInfo& info, HighlightMode mode,
return;
}
if (TreeParams::getTreeActiveAutoExpand()) {
if (TreeParams::getTreeActiveAutoExpand() && (enable || vp->isAutoCollapseOnDeactivation())) {
vp->getDocument()->signalExpandObject(
*vp,
enable ? TreeItemMode::ExpandPath : TreeItemMode::CollapseItem,
+6
View File
@@ -445,6 +445,11 @@ public:
{
return true;
}
/** Tell if the tree item should be auto collapsed*/
bool isAutoCollapseOnDeactivation() const
{
return autoCollapseOnDeactivation;
}
/** @name Signals of the view provider */
//@{
@@ -707,6 +712,7 @@ protected:
/// The root separator for annotations
SoSeparator* pcAnnotation {nullptr};
ViewProviderPy* pyViewObject {nullptr};
bool autoCollapseOnDeactivation {true};
std::string overrideMode;
std::bitset<32> StatusBits;
/// whether visibility can toggled
@@ -151,6 +151,7 @@ void ViewProviderAssembly::setupContextMenu(QMenu* menu, QObject* receiver, cons
bool ViewProviderAssembly::doubleClicked()
{
if (isInEditMode()) {
autoCollapseOnDeactivation = true;
getDocument()->resetEdit();
}
else {
@@ -279,6 +280,7 @@ bool ViewProviderAssembly::setEdit(int mode)
if (mode == ViewProvider::Default) {
// Ask that this edit mode be restored. For example if it is quit to edit a sketch.
getDocument()->setEditRestore(true);
autoCollapseOnDeactivation = false;
// Set the part as 'Activated' ie bold in the tree.
Gui::Command::doCommand(