[libcamera-devel] [PATCH v2 08/21] qcam: main_window: Add shortcuts for toolbar actions
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Mar 23 18:35:46 CET 2020
Allow triggering toolbar actions with keyboard shortcuts.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
Changes since v1:
- Use QKeySequence::SaveAs
---
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 9f008a57f9a1..6afb7714c457 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -99,6 +99,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. */
@@ -120,12 +121,14 @@ int MainWindow::createToolbars()
action = toolbar_->addAction(iconPlay_, "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(QKeySequence::SaveAs);
connect(action, &QAction::triggered, this, &MainWindow::saveImageAs);
return 0;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list