diff options
| author | Karol Kosek <krkk@krkk.ct8.pl> | 2020-12-23 11:16:30 +0100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2020-12-24 23:29:59 +0100 |
| commit | 1ceae995f1984b2e9512752cf5e8d8b56d03d574 (patch) | |
| tree | e536f02e43a9046813ae7d246f10e23c3430fc45 /src | |
| parent | 6686c4ad47db6993bfaa442998e845f55ea50f40 (diff) | |
| download | kristall-1ceae995f1984b2e9512752cf5e8d8b56d03d574.tar.gz | |
Add shortcuts for Document Outline, Bookmark, and History docks
Had to use custom properties and rebind the Go home shortcut.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 8 | ||||
| -rw-r--r-- | src/mainwindow.ui | 11 |
2 files changed, 13 insertions, 6 deletions
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<QDockWidget *>()) { - 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<bool>::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 @@ <property name="windowTitle"> <string>Document Outline</string> </property> + <property name="_shortcut" stdset="0"> + <string>Ctrl+M</string> + </property> <attribute name="dockWidgetArea"> <number>1</number> </attribute> @@ -102,6 +105,9 @@ <property name="windowTitle"> <string>Bookmarks</string> </property> + <property name="_shortcut" stdset="0"> + <string>Ctrl+B</string> + </property> <attribute name="dockWidgetArea"> <number>2</number> </attribute> @@ -143,6 +149,9 @@ <property name="windowTitle"> <string>History</string> </property> + <property name="_shortcut" stdset="0"> + <string>Ctrl+H</string> + </property> <attribute name="dockWidgetArea"> <number>2</number> </attribute> @@ -357,7 +366,7 @@ <string>Go to home</string> </property> <property name="shortcut"> - <string>Ctrl+H</string> + <string>Alt+Home</string> </property> </action> <action name="actionHelp"> |
