Gui: Unavailable toolbars default to visible when made available
================================================================ https://github.com/FreeCAD/FreeCAD/issues/9208#issuecomment-1567469254 Issue: - Unavailable toolbars default to not visible (as they are unavailable) - However, when made available, they remain not visible. There may be cases when this is indeed the wanted behaviour, but they are not the ones we are facing. - In the latter, the user expects the toolbars to show (and the configuration file to be saved with all toolbars showing. Solution: - Change the default behaviour of Unavailable toolbars when forcing them to be available, so that they are visible when made available. - If then the case arises that we have toolbars where we would prefer then to be left not visible when making them available (so they are listed in the toolbar context menu to make them visible, but not visible per default), then we would need to create another toolbar policy class "UnavailableHidden". - I chose not to add it directly (although it is straightforward) in fear that we will never need it, and it would make the code more complex to understand and thus maintain.
This commit is contained in:
committed by
abdullahtahiriyo
parent
ee1fcb3f3a
commit
ef70f2e53d
@@ -536,7 +536,16 @@ void ToolBarManager::setState(const QString& name, State state)
|
||||
|
||||
tb->toggleViewAction()->setVisible(true);
|
||||
|
||||
showhide(tb, policy);
|
||||
// Unavailable policy defaults to a Visible toolbars when made available
|
||||
auto show = visibility( policy == ToolBarItem::DefaultVisibility::Visible ||
|
||||
policy == ToolBarItem::DefaultVisibility::Unavailable);
|
||||
|
||||
if(show) {
|
||||
tb->show();
|
||||
}
|
||||
else {
|
||||
tb->hide();
|
||||
}
|
||||
}
|
||||
else if (state == State::ForceHidden) {
|
||||
tb->toggleViewAction()->setVisible(false); // not visible in context menus
|
||||
|
||||
@@ -44,7 +44,8 @@ public:
|
||||
Hidden, // toolbar hidden by default, visibility toggle action is enabled
|
||||
Unavailable, // toolbar visibility is managed independently by client code and defaults to
|
||||
// hidden, visibility toggle action is disabled by default (it is unavailable
|
||||
// to the UI).
|
||||
// to the UI). Upon being forced to be available, these toolbars default to
|
||||
// visible.
|
||||
};
|
||||
|
||||
ToolBarItem();
|
||||
|
||||
Reference in New Issue
Block a user