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 <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b562c36a9a7be5f62a8e79b93c9728381775f460)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2025-01-09 11:02:37 +01:00 committed by Qt Cherry-pick Bot
parent b7711eb94c
commit e09afd3cc0
2 changed files with 26 additions and 0 deletions

View File

@ -3,6 +3,8 @@
#include "qfontvariableaxis.h" #include "qfontvariableaxis.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QFontVariableAxisPrivate : public QSharedData class QFontVariableAxisPrivate : public QSharedData
@ -223,4 +225,24 @@ void QFontVariableAxis::detach()
d_ptr.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 QT_END_NAMESPACE

View File

@ -56,6 +56,10 @@ private:
QByteArray tagString() const { return tag().toString(); } QByteArray tagString() const { return tag().toString(); }
void detach(); void detach();
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT friend QDebug operator<<(QDebug debug, const QFontVariableAxis &axis);
#endif
QExplicitlySharedDataPointer<QFontVariableAxisPrivate> d_ptr; QExplicitlySharedDataPointer<QFontVariableAxisPrivate> d_ptr;
}; };