Added option to hide inactive documents in tree view.
This commit is contained in:
@@ -2818,6 +2818,42 @@ void CmdViewMeasureToggleAll::activated(int iMsg)
|
||||
group->SetBool("DimensionsVisible", true);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_TreeHideInactiveDocs
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_C(StdTreeHideInactiveDocs);
|
||||
|
||||
StdTreeHideInactiveDocs::StdTreeHideInactiveDocs()
|
||||
: Command("Std_TreeHideInactiveDocs")
|
||||
{
|
||||
sGroup = QT_TR_NOOP("View");
|
||||
sMenuText = QT_TR_NOOP("Hide inactive documents in tree");
|
||||
sToolTipText = QT_TR_NOOP("Toggles hiding inactive documents in document tree");
|
||||
sWhatsThis = "Std_TreeHideInactiveDocs";
|
||||
sStatusTip = QT_TR_NOOP("Toggles hiding inactive documents in document tree");
|
||||
eType = 0;
|
||||
}
|
||||
|
||||
Action * StdTreeHideInactiveDocs::createAction(void)
|
||||
{
|
||||
Action *pcAction = Command::createAction();
|
||||
pcAction->setCheckable(true);
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("View");
|
||||
pcAction->setChecked(group->GetBool("TreeHideInactiveDocs", false));
|
||||
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
void StdTreeHideInactiveDocs::activated(int iMsg)
|
||||
{
|
||||
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("View");
|
||||
group->SetBool("TreeHideInactiveDocs", iMsg != 0);
|
||||
App::GetApplication().setActiveDocument(App::GetApplication().getActiveDocument());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Instantiation
|
||||
//===========================================================================
|
||||
@@ -2886,6 +2922,7 @@ void CreateViewStdCommands(void)
|
||||
rcCmdMgr.addCommand(new StdCmdAxisCross());
|
||||
rcCmdMgr.addCommand(new CmdViewMeasureClearAll());
|
||||
rcCmdMgr.addCommand(new CmdViewMeasureToggleAll());
|
||||
rcCmdMgr.addCommand(new StdTreeHideInactiveDocs());
|
||||
}
|
||||
|
||||
} // namespace Gui
|
||||
|
||||
@@ -706,12 +706,15 @@ void TreeWidget::slotActiveDocument(const Gui::Document& Doc)
|
||||
std::map<const Gui::Document*, DocumentItem*>::iterator jt = DocumentMap.find(&Doc);
|
||||
if (jt == DocumentMap.end())
|
||||
return; // signal is emitted before the item gets created
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
bool hideInactive = hGrp->GetBool("TreeHideInactiveDocs", false);
|
||||
for (std::map<const Gui::Document*, DocumentItem*>::iterator it = DocumentMap.begin();
|
||||
it != DocumentMap.end(); ++it)
|
||||
{
|
||||
QFont f = it->second->font(0);
|
||||
f.setBold(it == jt);
|
||||
it->second->setFont(0,f);
|
||||
it->second->setHidden(hideInactive && it != jt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -550,6 +550,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Std_ToggleVisibility" << "Std_ToggleNavigation"
|
||||
<< "Std_SetAppearance" << "Std_RandomColor" << "Separator"
|
||||
<< "Std_Workbench" << "Std_ToolBarMenu" << "Std_DockViewMenu" << "Separator"
|
||||
<< "Std_TreeHideInactiveDocs"
|
||||
<< "Std_ViewStatusBar";
|
||||
|
||||
// Tools
|
||||
|
||||
Reference in New Issue
Block a user