From 87eb0a9bf1ad7fa95e41b90f351bcc3aff4c726a Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Sat, 30 Oct 2021 21:05:14 +0200 Subject: [PATCH] add shortcuts for menu items --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 9f469bd..dc034d6 100644 --- a/main.py +++ b/main.py @@ -53,9 +53,11 @@ class MainWindow(QMainWindow): file_menu = QMenu(self.tr("&File", "name of the file menu"), self) open_file = QAction(self.tr("&Open..."), self) + open_file.setShortcut('Ctrl+O') open_file.triggered.connect(self._open_file_dialog) close_action = QAction(self.tr("E&xit", "menu item to close the application"), self) + close_action.setShortcut('Ctrl+X') close_action.triggered.connect(self.destruct) self._update_recent_files_menu() @@ -68,6 +70,7 @@ class MainWindow(QMainWindow): def highlight_menu(self) -> QMenu: result = QMenu(self.tr("&Highlighting"), self) manage = QAction(self.tr("&Manage"), self) + manage.setShortcut('Ctrl+M') manage.triggered.connect(lambda: HighlightingDialog(self.settings).exec()) result.addAction(manage) return result