From 734429f4a3b20f85f231bd9c8920bf3aa7f14e74 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 7 Jun 2021 09:49:23 +0200 Subject: [PATCH] QDebug: add support for QVarLengthArray Remove a conflicting definition of the same operator from qrhi.cpp. Who knows how many ODR violations this hidden gem may have caused... [ChangeLog][QtCore][QDebug] Can now stream QVarLengthArray objects. [ChangeLog][QtCore][QVarLengthArray] Can now be output via QDebug streaming. Change-Id: I12f7670e32029fa8c96b446e9a98ebf3b9732d0d Reviewed-by: Giuseppe D'Angelo --- src/corelib/io/qdebug.h | 7 +++++++ src/gui/rhi/qrhi.cpp | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 29da386c1b8..71ad610e19e 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -249,6 +250,12 @@ inline QDebugIfHasDebugStream operator<<(QDebug debug, const QList &vec) return QtPrivate::printSequentialContainer(debug, "QList", vec); } +template +inline QDebugIfHasDebugStream operator<<(QDebug debug, const QVarLengthArray &vec) +{ + return QtPrivate::printSequentialContainer(debug, "QVarLengthArray", vec); +} + template inline QDebugIfHasDebugStream operator<<(QDebug debug, const std::vector &vec) { diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index 78c615451e1..4ae75b5df57 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -1366,12 +1366,6 @@ size_t qHash(const QRhiVertexInputLayout &v, size_t seed) noexcept } #ifndef QT_NO_DEBUG_STREAM -template -QDebug operator<<(QDebug dbg, const QVarLengthArray &vla) -{ - return QtPrivate::printSequentialContainer(dbg, "VLA", vla); -} - QDebug operator<<(QDebug dbg, const QRhiVertexInputLayout &v) { QDebugStateSaver saver(dbg);