diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 07962f6ffb..581924f187 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -2861,6 +2861,28 @@ void StdTreeMultiDocument::activated(int iMsg) } +//=========================================================================== +// Std_TreeCollapseDocument +//=========================================================================== +DEF_STD_CMD(StdTreeCollapseDocument) + +StdTreeCollapseDocument::StdTreeCollapseDocument() + : Command("Std_TreeCollapseDocument") +{ + sGroup = QT_TR_NOOP("View"); + sMenuText = QT_TR_NOOP("Collapse/Expand"); + sToolTipText = QT_TR_NOOP("Expand active document and collapse all others"); + sWhatsThis = "Std_TreeCollapseDocument"; + sStatusTip = QT_TR_NOOP("Expand active document and collapse all others"); + eType = 0; +} + +void StdTreeCollapseDocument::activated(int iMsg) +{ + Q_UNUSED(iMsg); +} + + //=========================================================================== // Std_TreeViewDocument //=========================================================================== @@ -2880,6 +2902,7 @@ StdTreeViewDocument::StdTreeViewDocument() CommandManager &rcCmdMgr = Application::Instance->commandManager(); rcCmdMgr.addCommand(new StdTreeSingleDocument()); rcCmdMgr.addCommand(new StdTreeMultiDocument()); + rcCmdMgr.addCommand(new StdTreeCollapseDocument()); } Action * StdTreeViewDocument::createAction(void) @@ -2891,8 +2914,10 @@ Action * StdTreeViewDocument::createAction(void) CommandManager &grp = Application::Instance->commandManager(); Command* cmd0 = grp.getCommandByName("Std_TreeSingleDocument"); Command* cmd1 = grp.getCommandByName("Std_TreeMultiDocument"); + Command* cmd2 = grp.getCommandByName("Std_TreeCollapseDocument"); cmd0->addToGroup(pcAction, true); cmd1->addToGroup(pcAction, true); + cmd2->addToGroup(pcAction, true); return pcAction; } diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 6dc60fac43..157a7e5c88 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -713,8 +713,11 @@ void TreeWidget::slotActiveDocument(const Gui::Document& Doc) { QFont f = it->second->font(0); f.setBold(it == jt); - it->second->setFont(0,f); + it->second->setFont(0, f); it->second->setHidden(0 == displayMode && it != jt); + if (2 == displayMode) { + it->second->setExpanded(it == jt); + } } }