[3/4] apps: qcam: Use standard key sequence for quit action
diff mbox series

Message ID 20240503025205.2814-4-laurent.pinchart@ideasonboard.com
State Accepted
Commit 4885f2d70d71f92d505cb33738dd592727cd036c
Headers show
Series
  • libcamera: Assorted cleanups and fixes
Related show

Commit Message

Laurent Pinchart May 3, 2024, 2:52 a.m. UTC
Replace the manual CTRL+Q key sequence with QKeySequence::Quit. This
automatically maps to the native shortcut for the quit action,
regardless of the platform. Even though we don't expect qcam to run on
non-Linux platform, using a QKeySequence is still a good practice when
one exists.

This doesn't change qcam's behaviour, as the native quit key sequence is
CTRL+Q on Linux systems.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/apps/qcam/main_window.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Umang Jain May 3, 2024, 6:06 a.m. UTC | #1
Hi Laurent

Thank you for the patch

On 03/05/24 8:22 am, Laurent Pinchart wrote:
> Replace the manual CTRL+Q key sequence with QKeySequence::Quit. This
> automatically maps to the native shortcut for the quit action,
> regardless of the platform. Even though we don't expect qcam to run on
> non-Linux platform, using a QKeySequence is still a good practice when
> one exists.
>
> This doesn't change qcam's behaviour, as the native quit key sequence is
> CTRL+Q on Linux systems.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   src/apps/qcam/main_window.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
> index 0f16c038d516..361d582532d5 100644
> --- a/src/apps/qcam/main_window.cpp
> +++ b/src/apps/qcam/main_window.cpp
> @@ -190,7 +190,7 @@ int MainWindow::createToolbars()
>   	action = toolbar_->addAction(QIcon::fromTheme("application-exit",
>   						      QIcon(":x-circle.svg")),
>   				     "Quit");
> -	action->setShortcut(Qt::CTRL | Qt::Key_Q);
> +	action->setShortcut(QKeySequence::Quit);
>   	connect(action, &QAction::triggered, this, &MainWindow::quit);
>   
>   	/* Camera selector. */
Stefan Klug May 3, 2024, 2:43 p.m. UTC | #2
Hi Laurent,

thanks for the patch.

On Fri, May 03, 2024 at 05:52:04AM +0300, Laurent Pinchart wrote:
> Replace the manual CTRL+Q key sequence with QKeySequence::Quit. This
> automatically maps to the native shortcut for the quit action,
> regardless of the platform. Even though we don't expect qcam to run on
> non-Linux platform, using a QKeySequence is still a good practice when
> one exists.
> 
> This doesn't change qcam's behaviour, as the native quit key sequence is
> CTRL+Q on Linux systems.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> 

Cheers,
Stefan

> ---
>  src/apps/qcam/main_window.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
> index 0f16c038d516..361d582532d5 100644
> --- a/src/apps/qcam/main_window.cpp
> +++ b/src/apps/qcam/main_window.cpp
> @@ -190,7 +190,7 @@ int MainWindow::createToolbars()
>  	action = toolbar_->addAction(QIcon::fromTheme("application-exit",
>  						      QIcon(":x-circle.svg")),
>  				     "Quit");
> -	action->setShortcut(Qt::CTRL | Qt::Key_Q);
> +	action->setShortcut(QKeySequence::Quit);
>  	connect(action, &QAction::triggered, this, &MainWindow::quit);
>  
>  	/* Camera selector. */
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
index 0f16c038d516..361d582532d5 100644
--- a/src/apps/qcam/main_window.cpp
+++ b/src/apps/qcam/main_window.cpp
@@ -190,7 +190,7 @@  int MainWindow::createToolbars()
 	action = toolbar_->addAction(QIcon::fromTheme("application-exit",
 						      QIcon(":x-circle.svg")),
 				     "Quit");
-	action->setShortcut(Qt::CTRL | Qt::Key_Q);
+	action->setShortcut(QKeySequence::Quit);
 	connect(action, &QAction::triggered, this, &MainWindow::quit);
 
 	/* Camera selector. */