[libcamera-devel] [PATCH] qcam: fix Qt5.15.0 compile

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sun Jun 7 19:17:29 CEST 2020


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 ?

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 ?

>  
>  	/* Render the frame on the viewfinder. */
>  	viewfinder_->render(buffer, &mappedBuffers_[buffer]);

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list