From 3bf7aad1f7e69d70066d7c89f0c4d22d7cc5f5bf Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Wed, 16 May 2018 14:48:27 +0300 Subject: [PATCH] Add a shortcut to focus scan popup's article view The article view focus is necessary to navigate a word definition via keyboard rather than mouse. The shortcut - Ctrl+N - is the same as the one in the main window for the corresponding action. --- articleview.hh | 4 ++-- scanpopup.cc | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/articleview.hh b/articleview.hh index 8c650aa5..b849b0dc 100644 --- a/articleview.hh +++ b/articleview.hh @@ -136,12 +136,12 @@ public slots: /// Goes forward in history void forward(); -public: - /// Takes the focus to the view void focus() { ui.definition->setFocus( Qt::ShortcutFocusReason ); } +public: + /// Reloads the view void reload() { ui.definition->reload(); } diff --git a/scanpopup.cc b/scanpopup.cc index a4c92cd4..26c32401 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -229,6 +229,11 @@ ScanPopup::ScanPopup( QWidget * parent, connect( &focusTranslateLineAction, SIGNAL( triggered() ), this, SLOT( focusTranslateLine() ) ); + QAction * const focusArticleViewAction = new QAction( this ); + focusArticleViewAction->setShortcutContext( Qt::WidgetWithChildrenShortcut ); + focusArticleViewAction->setShortcut( QKeySequence( "Ctrl+N" ) ); + addAction( focusArticleViewAction ); + connect( focusArticleViewAction, SIGNAL( triggered() ), definition, SLOT( focus() ) ); switchExpandModeAction.setShortcuts( QList< QKeySequence >() << QKeySequence( Qt::CTRL + Qt::Key_8 ) <<