From 59c402417122e2ec2ee3c49b5768646581103d47 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 14 Mar 2015 12:41:10 +0100 Subject: QDebug operator for Q_FLAG when the QFlags itself is registered Currently, IsQEnumHelper returns true also if QFlags is registered as a Q_FLAG. But this is going to be changed in the next commit. For the QDebug operator to continue to work even when the QFlags is registered and not the T, we need to take it into account in the QEnableIf condition Change-Id: If1fcffd133aa20ba95a07e2bfaaa308896ab01b0 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 7f1cb82f3a..89e2bb0afd 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -275,7 +275,10 @@ operator<<(QDebug dbg, T value) } template -inline typename QtPrivate::QEnableIf::Value, QDebug>::Type operator<<(QDebug debug, const QFlags &flags) +inline typename QtPrivate::QEnableIf< + QtPrivate::IsQEnumHelper::Value || QtPrivate::IsQEnumHelper >::Value, + QDebug>::Type +operator<<(QDebug debug, const QFlags &flags) { const QMetaObject *obj = qt_getEnumMetaObject(T()); const char *name = qt_getEnumName(T()); @@ -283,7 +286,10 @@ inline typename QtPrivate::QEnableIf::Value, QDebug> } template -inline typename QtPrivate::QEnableIf::Value, QDebug>::Type operator<<(QDebug debug, const QFlags &flags) +inline typename QtPrivate::QEnableIf< + !QtPrivate::IsQEnumHelper::Value && !QtPrivate::IsQEnumHelper >::Value, + QDebug>::Type +operator<<(QDebug debug, const QFlags &flags) #else // !QT_NO_QOBJECT template inline QDebug operator<<(QDebug debug, const QFlags &flags) -- cgit v1.2.3