Gui: Add ability to easily lock Toolbars from UI
This adds the Std_ToggleToolBarLock action mentioned in #4992. It is exposed in the context menu of toolbar and also in the view -> toolbars app menu.
This commit is contained in:
@@ -408,11 +408,7 @@ void ToolBarManager::restoreState() const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hPref = App::GetApplication().GetUserParameter().GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")->GetGroup("General");
|
||||
bool lockToolBars = hPref->GetBool("LockToolBars", false);
|
||||
setMovable(!lockToolBars);
|
||||
setMovable(!areToolBarsLocked());
|
||||
}
|
||||
|
||||
void ToolBarManager::retranslate() const
|
||||
@@ -426,6 +422,30 @@ void ToolBarManager::retranslate() const
|
||||
}
|
||||
}
|
||||
|
||||
bool Gui::ToolBarManager::areToolBarsLocked() const
|
||||
{
|
||||
auto hPref = App::GetApplication()
|
||||
.GetUserParameter()
|
||||
.GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("General");
|
||||
|
||||
return hPref->GetBool("LockToolBars", false);
|
||||
}
|
||||
|
||||
void Gui::ToolBarManager::setToolBarsLocked(bool locked) const
|
||||
{
|
||||
auto hPref = App::GetApplication()
|
||||
.GetUserParameter()
|
||||
.GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")
|
||||
->GetGroup("General");
|
||||
|
||||
hPref->SetBool("LockToolBars", locked);
|
||||
|
||||
setMovable(!locked);
|
||||
}
|
||||
|
||||
void Gui::ToolBarManager::setMovable(bool moveable) const
|
||||
{
|
||||
for (auto& tb : toolBars()) {
|
||||
|
||||
Reference in New Issue
Block a user