summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Seiderer <ps.report@gmx.net>2020-06-07 18:56:55 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-06-09 13:38:36 +0300
commit8823461d80ad64b972bc6d568c47aba50bed26a4 (patch)
treefe962d4ff9e796ec578edcaf45ccabf25540fac8 /src
parent6781f8b46362c390d841afc3c0271c1b96f9fa30 (diff)
qcam: Fix compilation with Qt v5.15.0
Starting from Qt v5.15.0, the QTextStreamFunctions::fixed function used to configure formatting on QTextStream is deprecated in favour of Qt::fixed. This causes a compilation error: ../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; | ^~~~~ Fix it by using Qt::fixed, and provide backward compatibility with Qt versions older than v5.14.0 that didn't provide Qt::fixed. Signed-off-by: Peter Seiderer <ps.report@gmx.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> # 5.12.8 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/qcam/main_window.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index 7de08957..2960259f 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -31,6 +31,16 @@
using namespace libcamera;
+#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 {
+constexpr auto fixed = ::fixed;
+} /* namespace Qt */
+#endif
+
/**
* \brief Custom QEvent to signal capture completion
*/
@@ -631,7 +641,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;
/* Render the frame on the viewfinder. */
viewfinder_->render(buffer, &mappedBuffers_[buffer]);