Message ID | 20200323142205.28342-9-laurent.pinchart@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Laurent, On 23/03/2020 14:21, Laurent Pinchart wrote: > Allow triggering toolbar actions with keyboard shortcuts. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/qcam/main_window.cpp | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp > index 14baf7ec4c2e..18aae07ffce7 100644 > --- a/src/qcam/main_window.cpp > +++ b/src/qcam/main_window.cpp > @@ -100,6 +100,7 @@ int MainWindow::createToolbars() > action = toolbar_->addAction(QIcon::fromTheme("application-exit", > QIcon(":x-circle.svg")), > "Quit"); > + action->setShortcut(Qt::CTRL | Qt::Key_Q); Nice... > connect(action, &QAction::triggered, this, &MainWindow::quit); > > /* Camera selection. */ > @@ -118,12 +119,14 @@ int MainWindow::createToolbars() > QIcon(":play-circle.svg")), > "Start Capture"); > action->setCheckable(true); > + action->setShortcut(Qt::Key_Space); Also nice ;-) > connect(action, &QAction::toggled, this, &MainWindow::toggleCapture); > startStopAction_ = action; > > action = toolbar_->addAction(QIcon::fromTheme("document-save-as", > QIcon(":save.svg")), > "Save As..."); > + action->setShortcut(Qt::CTRL | Qt::Key_S); Hrm ... this should likely be 'Shift-Ctrl-A', But as we have no 'Save' (which would be Ctrl-A) it could be updated later when we add the next bit of functionality ... Updated or not there, Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > connect(action, &QAction::triggered, this, &MainWindow::saveImageAs); > > return 0; >
Hi Kieran, On Mon, Mar 23, 2020 at 03:24:57PM +0000, Kieran Bingham wrote: > On 23/03/2020 14:21, Laurent Pinchart wrote: > > Allow triggering toolbar actions with keyboard shortcuts. > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > > src/qcam/main_window.cpp | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp > > index 14baf7ec4c2e..18aae07ffce7 100644 > > --- a/src/qcam/main_window.cpp > > +++ b/src/qcam/main_window.cpp > > @@ -100,6 +100,7 @@ int MainWindow::createToolbars() > > action = toolbar_->addAction(QIcon::fromTheme("application-exit", > > QIcon(":x-circle.svg")), > > "Quit"); > > + action->setShortcut(Qt::CTRL | Qt::Key_Q); > > Nice... > > > connect(action, &QAction::triggered, this, &MainWindow::quit); > > > > /* Camera selection. */ > > @@ -118,12 +119,14 @@ int MainWindow::createToolbars() > > QIcon(":play-circle.svg")), > > "Start Capture"); > > action->setCheckable(true); > > + action->setShortcut(Qt::Key_Space); > > > Also nice ;-) > > > connect(action, &QAction::toggled, this, &MainWindow::toggleCapture); > > startStopAction_ = action; > > > > action = toolbar_->addAction(QIcon::fromTheme("document-save-as", > > QIcon(":save.svg")), > > "Save As..."); > > + action->setShortcut(Qt::CTRL | Qt::Key_S); > > Hrm ... this should likely be 'Shift-Ctrl-A', > > But as we have no 'Save' (which would be Ctrl-A) it could be updated > later when we add the next bit of functionality ... Updated with QtKeySequence::SaveAs. > Updated or not there, > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > connect(action, &QAction::triggered, this, &MainWindow::saveImageAs); > > > > return 0;
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 14baf7ec4c2e..18aae07ffce7 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -100,6 +100,7 @@ int MainWindow::createToolbars() action = toolbar_->addAction(QIcon::fromTheme("application-exit", QIcon(":x-circle.svg")), "Quit"); + action->setShortcut(Qt::CTRL | Qt::Key_Q); connect(action, &QAction::triggered, this, &MainWindow::quit); /* Camera selection. */ @@ -118,12 +119,14 @@ int MainWindow::createToolbars() QIcon(":play-circle.svg")), "Start Capture"); action->setCheckable(true); + action->setShortcut(Qt::Key_Space); connect(action, &QAction::toggled, this, &MainWindow::toggleCapture); startStopAction_ = action; action = toolbar_->addAction(QIcon::fromTheme("document-save-as", QIcon(":save.svg")), "Save As..."); + action->setShortcut(Qt::CTRL | Qt::Key_S); connect(action, &QAction::triggered, this, &MainWindow::saveImageAs); return 0;
Allow triggering toolbar actions with keyboard shortcuts. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/qcam/main_window.cpp | 3 +++ 1 file changed, 3 insertions(+)