[libcamera-devel] [PATCH 07/21] qcam: main_window: Use icons from system icon theme

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Mar 23 16:18:57 CET 2020


Hi Laurent,

On 23/03/2020 14:21, Laurent Pinchart wrote:
> Use the system icon theme by default, falling back to custom icons if no
> theme is available.

Aha, I hadn't realised it was easy enough to obtain theme icons.

I 'think' I prefer this except...

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
>  src/qcam/main_window.cpp | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> index 86f92360a1a9..14baf7ec4c2e 100644
> --- a/src/qcam/main_window.cpp
> +++ b/src/qcam/main_window.cpp
> @@ -97,7 +97,9 @@ int MainWindow::createToolbars()
>  	/* Disable right click context menu. */
>  	toolbar_->setContextMenuPolicy(Qt::PreventContextMenu);
>  
> -	action = toolbar_->addAction(QIcon(":x-circle.svg"), "Quit");
> +	action = toolbar_->addAction(QIcon::fromTheme("application-exit",
> +						      QIcon(":x-circle.svg")),
> +				     "Quit");
>  	connect(action, &QAction::triggered, this, &MainWindow::quit);
>  
>  	/* Camera selection. */
> @@ -112,12 +114,16 @@ int MainWindow::createToolbars()
>  
>  	toolbar_->addSeparator();
>  
> -	action = toolbar_->addAction(QIcon(":play-circle.svg"), "Start Capture");
> +	action = toolbar_->addAction(QIcon::fromTheme("media-playback-start",
> +						      QIcon(":play-circle.svg")),
> +				     "Start Capture");
>  	action->setCheckable(true);
>  	connect(action, &QAction::toggled, this, &MainWindow::toggleCapture);
>  	startStopAction_ = action;
>  
> -	action = toolbar_->addAction(QIcon(":save.svg"), "saveAs");
> +	action = toolbar_->addAction(QIcon::fromTheme("document-save-as",

This now looks like a 'document' instead of a disk ... ;-(

But maybe that's not the end of the world, and a potential restriction
of the theme more than this patch ... so ...

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>



> +						      QIcon(":save.svg")),
> +				     "Save As...");
>  	connect(action, &QAction::triggered, this, &MainWindow::saveImageAs);
>  
>  	return 0;
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list