aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow')
-rw-r--r--src/mainwindow/mainwindow.cpp5
-rw-r--r--src/mainwindow/menubar.cpp14
-rw-r--r--src/mainwindow/widgets/navigationbar.cpp2
3 files changed, 17 insertions, 4 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index 5386aab..e03ec46 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -41,8 +41,6 @@ MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, mdiArea(new QMdiArea(this))
{
- m_menuBar = new MenuBar(this);
- this->setMenuBar(m_menuBar);
Configuration config;
@@ -82,6 +80,9 @@ MainWindow::MainWindow(QWidget *parent)
this->addToolBarBreak();
this->addToolBar(new BookmarksToolbar(app->bookmarks()->model(), this));
+ m_menuBar = new MenuBar(this);
+ this->setMenuBar(m_menuBar);
+
mdiArea->setBackground(Qt::NoBrush);
setCentralWidget(mdiArea);
mdiArea->setFocus();
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"));
}
diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp
index 89e1e50..75bc90c 100644
--- a/src/mainwindow/widgets/navigationbar.cpp
+++ b/src/mainwindow/widgets/navigationbar.cpp
@@ -23,6 +23,8 @@
NavigationBar::NavigationBar(QWidget *parent)
: QToolBar(parent)
{
+ setObjectName("navigationbar");
+ setWindowTitle(tr("Navigation Toolbar"));
Configuration config;
// Back button