From 1ceae995f1984b2e9512752cf5e8d8b56d03d574 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Wed, 23 Dec 2020 11:16:30 +0100 Subject: Add shortcuts for Document Outline, Bookmark, and History docks Had to use custom properties and rebind the Go home shortcut. --- src/mainwindow.cpp | 8 +++----- src/mainwindow.ui | 11 ++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b129414..fc0d94e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -43,12 +43,10 @@ MainWindow::MainWindow(QApplication * app, QWidget *parent) : for(QDockWidget * dock : findChildren()) { - QAction * act = this->ui->menuView ->addAction(dock->windowTitle()); - act->setCheckable(true); - act->setChecked(dock->isVisible()); - act->setData(QVariant::fromValue(dock)); + QAction * act = dock->toggleViewAction(); + act->setShortcut(dock->property("_shortcut").toString()); // act->setIcon(dock->windowIcon()); - connect(act, QOverload::of(&QAction::triggered), dock, &QDockWidget::setVisible); + this->ui->menuView->addAction(act); } connect(this->ui->menuNavigation, &QMenu::aboutToShow, [this]() { diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 5698074..016b22c 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -64,6 +64,9 @@ Document Outline + + Ctrl+M + 1 @@ -102,6 +105,9 @@ Bookmarks + + Ctrl+B + 2 @@ -143,6 +149,9 @@ History + + Ctrl+H + 2 @@ -357,7 +366,7 @@ Go to home - Ctrl+H + Alt+Home -- cgit v1.2.3