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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Mar 23 17:19:27 CET 2020


Hi Kieran,

On Mon, Mar 23, 2020 at 03:18:57PM +0000, Kieran Bingham wrote:
> 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 ... ;-(

I'm sorry :-S

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

>From the screenshot you've shown me, I would say it's a bug in the icon
theme, not a restriction.

> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> > +						      QIcon(":save.svg")),
> > +				     "Save As...");
> >  	connect(action, &QAction::triggered, this, &MainWindow::saveImageAs);
> >  
> >  	return 0;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list