[libcamera-devel] Trying to use libcamera with Qt

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Mar 26 05:20:07 CET 2021


Hi Jason,

On Thu, Mar 25, 2021 at 08:28:02PM +0100, Jason H wrote:
> > Sent: Thursday, March 25, 2021 at 3:14 PM
> > From: "Jason H" <jhihn at gmx.com>
> > To: libcamera-devel at lists.libcamera.org
> > Subject: [libcamera-devel] Trying to use libcamera with Qt
> >
> > I was using Raspicam library, but it looks like this one (libcamera)
> > is the one to use if I need to control gains and shutter speed.

It's the way forward indeed :-)

> > I am using Qt5.15. I set Qt to use c++14 and set the include path,
> > #included libcamera/libcamera.h and got:
> > 
> > 
> > /usr/local/include/libcamera/libcamera/signal.h:31:17: error: expected unqualified-id before ‘)’ token
> >   SlotList slots();
> >                  ^
> > /usr/local/include/libcamera/libcamera/signal.h:119:16: error: expected ‘)’ before ‘...’ token
> >   void emit(Args... args)
> > 
> > I am trying to use this library in a Qt project, but I get a compile error in:
> > 
> > Qt does use the word `slots`, but only for classes marked Q_OBJECT
> > this one is not marked Q_OBJECT.
> 
> So it looks I was wrong about Q_OBJECT being the gatekeeper. Once I
> config no_keywords in Qt, it works. It's a shame I have to do that for
> one variable name.

Sorry about that :-( We do the same in our qcam test application. Qt
defines 'signals' and 'slots' as keywords by default, but that can
indeed clash with third-party code. Using Q_SIGNALS and Q_SLOTS instead
with no_keywords may not look very native, but hopefully it will be an
acceptable solution for you.

> It is the project using Boost at all? It doesn't look like it, but I
> am not a boost expert.

Only in the Raspberry Pi Image Processing Algorithms module, to parse
the configuration file, and we're working on an alternative
implementation that won't require Boost.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list