When activating a part container in the tree view make sure all parent items are expanded
This commit is contained in:
@@ -1342,13 +1342,24 @@ void DocumentItem::slotHighlightObject (const Gui::ViewProviderDocumentObject& o
|
||||
|
||||
void DocumentItem::slotExpandObject (const Gui::ViewProviderDocumentObject& obj,const Gui::TreeItemMode& mode)
|
||||
{
|
||||
// In the past it was checked if the parent item is collapsed and if yes nothing was done.
|
||||
// Now with the auto-expand mechanism of active part containers or bodies it must be made
|
||||
// sure to expand all parent items when expanding a child item.
|
||||
// Example:
|
||||
// When there are two nested part containers and if first the outer and then the inner is
|
||||
// activated the outer will be collapsed and thus hides the inner item.
|
||||
// Alternatively, this could be handled inside ActiveObjectList::setObject() but querying
|
||||
// the parent-children relationship of the view providers is rather inefficient.
|
||||
FOREACH_ITEM(item,obj)
|
||||
if (!item->parent() || // has no parent (see #0003025)
|
||||
!item->parent()->isExpanded()) continue;
|
||||
switch (mode) {
|
||||
case Gui::Expand:
|
||||
case Gui::Expand: {
|
||||
QTreeWidgetItem* parent = item->parent();
|
||||
while (parent) {
|
||||
parent->setExpanded(true);
|
||||
parent = parent->parent();
|
||||
}
|
||||
item->setExpanded(true);
|
||||
break;
|
||||
} break;
|
||||
case Gui::Collapse:
|
||||
item->setExpanded(false);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user