[Gui] Add hidden pref to lock toolbars

When arranged vertically, the bar that allows the dragging of toolbars
can cause problems with the toolbar appearance. This adds a hidden
preference that controls whether the toolbars are movable.
This commit is contained in:
Chris Hennes
2021-08-23 20:26:12 -05:00
parent f76abee290
commit 1a8a23a6a6
2 changed files with 20 additions and 0 deletions

View File

@@ -250,6 +250,11 @@ void ToolBarManager::setup(ToolBarItem* toolBarItems)
(*it)->hide();
(*it)->toggleViewAction()->setVisible(false);
}
hPref = App::GetApplication().GetUserParameter().GetGroup("BaseApp")
->GetGroup("Preferences")->GetGroup("General");
bool lockToolBars = hPref->GetBool("LockToolBars", false);
setMovable(!lockToolBars);
}
void ToolBarManager::setup(ToolBarItem* item, QToolBar* toolbar) const
@@ -314,6 +319,12 @@ void ToolBarManager::restoreState() const
toolbar->setVisible(hPref->GetBool(toolbarName.constData(), toolbar->isVisible()));
}
}
hPref = App::GetApplication().GetUserParameter().GetGroup("BaseApp")
->GetGroup("Preferences")->GetGroup("General");
bool lockToolBars = hPref->GetBool("LockToolBars", false);
setMovable(!lockToolBars);
}
void ToolBarManager::retranslate() const
@@ -327,6 +338,13 @@ void ToolBarManager::retranslate() const
}
}
void Gui::ToolBarManager::setMovable(bool moveable) const
{
for (auto& tb : toolBars()) {
tb->setMovable(moveable);
}
}
QToolBar* ToolBarManager::findToolBar(const QList<QToolBar*>& toolbars, const QString& item) const
{
for (QList<QToolBar*>::ConstIterator it = toolbars.begin(); it != toolbars.end(); ++it) {

View File

@@ -80,6 +80,8 @@ public:
void restoreState() const;
void retranslate() const;
void setMovable(bool movable) const;
protected:
void setup(ToolBarItem*, QToolBar*) const;
/** Returns a list of all currently existing toolbars. */