summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdebug.h
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2015-03-14 12:41:10 +0100
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2015-03-18 07:31:39 +0000
commit59c402417122e2ec2ee3c49b5768646581103d47 (patch)
treefdd20b53bb6419d5f51f03c66b219fd416b93f14 /src/corelib/io/qdebug.h
parentebdf9916600f0b0cd4d25b538d1fd0fef6e89077 (diff)
QDebug operator for Q_FLAG when the QFlags itself is registered
Currently, IsQEnumHelper<T> returns true also if QFlags<T> 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<T> is registered and not the T, we need to take it into account in the QEnableIf condition Change-Id: If1fcffd133aa20ba95a07e2bfaaa308896ab01b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qdebug.h')
-rw-r--r--src/corelib/io/qdebug.h10
1 files changed, 8 insertions, 2 deletions
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 <class T>
-inline typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, QDebug>::Type operator<<(QDebug debug, const QFlags<T> &flags)
+inline typename QtPrivate::QEnableIf<
+ QtPrivate::IsQEnumHelper<T>::Value || QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
+ QDebug>::Type
+operator<<(QDebug debug, const QFlags<T> &flags)
{
const QMetaObject *obj = qt_getEnumMetaObject(T());
const char *name = qt_getEnumName(T());
@@ -283,7 +286,10 @@ inline typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, QDebug>
}
template <class T>
-inline typename QtPrivate::QEnableIf<!QtPrivate::IsQEnumHelper<T>::Value, QDebug>::Type operator<<(QDebug debug, const QFlags<T> &flags)
+inline typename QtPrivate::QEnableIf<
+ !QtPrivate::IsQEnumHelper<T>::Value && !QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
+ QDebug>::Type
+operator<<(QDebug debug, const QFlags<T> &flags)
#else // !QT_NO_QOBJECT
template <class T>
inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)