[libcamera-devel] [PATCH] qcam: fix Qt5.15.0 compile
Peter Seiderer
ps.report at gmx.net
Sun Jun 7 23:58:26 CEST 2020
Hello Laurent,
On Sun, 7 Jun 2020 20:17:29 +0300, Laurent Pinchart <laurent.pinchart at ideasonboard.com> wrote:
> Hi Peter,
>
> Thank you for the patch.
>
> On Sun, Jun 07, 2020 at 06:56:55PM +0200, Peter Seiderer wrote:
> > Fixes:
> >
> > ../src/qcam/main_window.cpp:634:16: error: ‘QTextStream& QTextStreamFunctions::fixed(QTextStream&)’ is deprecated: Use Qt::fixed [-Werror=deprecated-declarations]
> > 634 | << "fps:" << fixed << qSetRealNumberPrecision(2) << fps;
> > | ^~~~~
> > Signed-off-by: Peter Seiderer <ps.report at gmx.net>
> > ---
> > src/qcam/main_window.cpp | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> > index 7de0895..1f3bdc1 100644
> > --- a/src/qcam/main_window.cpp
> > +++ b/src/qcam/main_window.cpp
> > @@ -631,7 +631,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer)
> > << QString("seq: %1").arg(metadata.sequence, 6, 10, QLatin1Char('0'))
> > << "bytesused:" << metadata.planes[0].bytesused
> > << "timestamp:" << metadata.timestamp
> > - << "fps:" << fixed << qSetRealNumberPrecision(2) << fps;
> > + << "fps:" << Qt::fixed << qSetRealNumberPrecision(2) << fps;
>
> Hasn't Qt::fixed been introduced in Qt v5.14, wouldn't this break
> compatibility with all older Qt versions ?
Yes, you are right...
>
> One option I haven't tested would be to keep Qt::fixed here, and add, at
> the top of this file, something along those lines.
>
> #if QT_VERSION <= QT_VERSION_CHECK(5, 14, 0)
> /*
> * Qt::fixed was introduced in v5.14, and ::fixed deprecated in v5.15. Allow
> * usage of Qt::fixed unconditionally.
> */
> namespace Qt {
> using fixed = ::fixed;
> } /* namespace Qt */
> #endif
>
> Would you be able to test this ?
Did try with Qt5.10.1 (with a standalone test program), leads to:
test-qt-fixed.cpp:10:17: error: ‘fixed’ in namespace ‘::’ does not name a type
10 | using fixed = ::fixed;
| ^~~~~
Alternative would be:
[...]
#if QT_VERSION <= QT_VERSION_CHECK(5, 14, 0)
<< fixed
#else
<< Qt::fixed
#endif
[...]
Should I re-spin the patch?
Regards,
Peter
>
> >
> > /* Render the frame on the viewfinder. */
> > viewfinder_->render(buffer, &mappedBuffers_[buffer]);
>
More information about the libcamera-devel
mailing list