From ece341e2f3ef90204b209012b2099b8e599eee08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 19 Dec 2018 18:14:59 +0100 Subject: Allow more fine grained control over QFont debug output With verbosity level 0, only the resolved properties are included in the debug output, which is useful when debugging font resolving. With verbosity level 1, the family, size, and weights are included, plus any resolved property that is different from the default value. Verbosity level 2, the QDebug default, has been kept unchanged, except removing quotes and spaces by adding nospace() and qPrintable. Verbosity level 3 includes all properties, regardless of whether or not they have been resolved. Levels 1 and 3 also include the resolve mask, to aid debugging. This gives the following results for a QFont set to 100pt: QFont(100pt) QFont(".SF NS Text", 100pt, Weight::Normal, resolveMask=SizeResolved) QFont(.SF NS Text,100,-1,5,50,0,0,0,0,0) QFont(".SF NS Text", 100pt, StyleHint::AnyStyle, StyleStrategy::PreferDefault, Weight::Normal, StyleNormal, underline=false, overline=false, strikeOut=false, fixedPitch=false, AnyStretch, kerning=true, MixedCase, letterSpacing=0 (PercentageSpacing), PreferDefaultHinting, styleName="", resolveMask=SizeResolved) Change-Id: Ib4aebd7346ef4a2946cc4450c12730cf7844c3bc Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/gui/text/qfont.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gui/text/qfont.h') diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index e86f06353a..35ef798275 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -147,6 +147,7 @@ public: Q_ENUM(SpacingType) enum ResolveProperties { + NoPropertiesResolved = 0x0000, FamilyResolved = 0x0001, SizeResolved = 0x0002, StyleHintResolved = 0x0004, @@ -167,6 +168,7 @@ public: FamiliesResolved = 0x20000, AllPropertiesResolved = 0x3ffff }; + Q_ENUM(ResolveProperties) QFont(); QFont(const QString &family, int pointSize = -1, int weight = -1, bool italic = false); @@ -335,6 +337,10 @@ private: friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QFont &); #endif +#ifndef QT_NO_DEBUG_STREAM + friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QFont &); +#endif + QExplicitlySharedDataPointer d; uint resolve_mask; }; -- cgit v1.2.3