[libcamera-devel] [PATCH 08/21] qcam: main_window: Add shortcuts for toolbar actions
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Mar 23 16:48:38 CET 2020
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 at 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 at ideasonboard.com>
>
> > connect(action, &QAction::triggered, this, &MainWindow::saveImageAs);
> >
> > return 0;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list