aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/menubar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow/menubar.cpp')
-rw-r--r--src/mainwindow/menubar.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp
index 27a8561..f1b3565 100644
--- a/src/mainwindow/menubar.cpp
+++ b/src/mainwindow/menubar.cpp
@@ -29,6 +29,7 @@
#include <QVBoxLayout>
#include <QWidgetAction>
#include <functional>
+#include <QToolBar>
inline void run_if(SubWindow *_subwindow, const std::function<void(SubWindow *, int)> &f)
{
@@ -161,14 +162,23 @@ MenuBar::MenuBar(MainWindow *parent)
});
setShortcut(actionNewSubwindow, "shortcuts.window.newgroup");
- window->addSeparator();
-
auto *actionTileSubwindows = window->addAction(tr("Tile Subwindows"), parent->mdiArea, &QMdiArea::tileSubWindows);
setShortcut(actionTileSubwindows, "shortcuts.subwindow.tile");
auto *actionCascadeSubwindows = window->addAction(tr("Cascade Subwindows"), parent->mdiArea, &QMdiArea::cascadeSubWindows);
setShortcut(actionCascadeSubwindows, "shortcuts.subwindow.cascade");
+ window->addSeparator()->setText(tr("Toolbars"));
+
+ for(auto *toolbar : parent->findChildren<QToolBar*>()) {
+ auto *action = window->addAction(toolbar->windowTitle());
+ action->setCheckable(true);
+ action->setChecked(toolbar->isVisible());
+ connect(toolbar, &QToolBar::visibilityChanged, action, &QAction::setChecked);
+ connect(action, &QAction::triggered, toolbar, &QToolBar::setVisible);
+ setShortcut(action, qUtf8Printable("shortcuts."+toolbar->objectName()+".show"));
+ }
+
window->addSeparator()->setText(tr("Subwindows"));
}