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:
Kacper Donat
2023-11-30 22:47:15 +01:00
committed by wwmayer
parent 9e1639783e
commit afd72f3585
5 changed files with 78 additions and 8 deletions

View File

@@ -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()) {