From e09afd3cc09d01256f04d25bdd8050e4b58edb3f Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 9 Jan 2025 11:02:37 +0100 Subject: [PATCH] QFontVariableAxis: add debug stream support Was missing from this new value type, and is quite useful for this type. Addresses API review comment. Change-Id: I07ea7ded7f963b2032c377f024bb88e9d54a4d5c Reviewed-by: Ivan Solovev Reviewed-by: Marc Mutz (cherry picked from commit b562c36a9a7be5f62a8e79b93c9728381775f460) Reviewed-by: Qt Cherry-pick Bot --- src/gui/text/qfontvariableaxis.cpp | 22 ++++++++++++++++++++++ src/gui/text/qfontvariableaxis.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/src/gui/text/qfontvariableaxis.cpp b/src/gui/text/qfontvariableaxis.cpp index dfce507afe3..1c253560b29 100644 --- a/src/gui/text/qfontvariableaxis.cpp +++ b/src/gui/text/qfontvariableaxis.cpp @@ -3,6 +3,8 @@ #include "qfontvariableaxis.h" +#include + QT_BEGIN_NAMESPACE class QFontVariableAxisPrivate : public QSharedData @@ -223,4 +225,24 @@ void QFontVariableAxis::detach() d_ptr.detach(); } +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug debug, const QFontVariableAxis &axis) +{ + QDebugStateSaver save(debug); + + debug.nospace().noquote(); + const QString name = axis.name(); + if (!name.isEmpty()) + debug << name << '('; + + debug << axis.tag(); + if (!name.isEmpty()) + debug << ')'; + debug << '[' << axis.minimumValue() << "..." << axis.maximumValue() + << "; default=" << axis.defaultValue() << ']'; + + return debug; +} +#endif + QT_END_NAMESPACE diff --git a/src/gui/text/qfontvariableaxis.h b/src/gui/text/qfontvariableaxis.h index 930acf7136c..0eb56ae6569 100644 --- a/src/gui/text/qfontvariableaxis.h +++ b/src/gui/text/qfontvariableaxis.h @@ -56,6 +56,10 @@ private: QByteArray tagString() const { return tag().toString(); } void detach(); +#ifndef QT_NO_DEBUG_STREAM + Q_GUI_EXPORT friend QDebug operator<<(QDebug debug, const QFontVariableAxis &axis); +#endif + QExplicitlySharedDataPointer d_ptr; };