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 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') 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]() { -- cgit v1.2.3