From 742ffd0f47abd8995a02da1b02dd0c8b5bc34706 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 1 Mar 2022 01:00:59 +0100 Subject: [PATCH] QDebug: streamline (private) formatQFlags The implementation for extracting a QMetaEnum from an enumeration type was duplicated from QMetaType::fromEnum, just use that one. Also add an explicit cast for the valueToKeys call. Change-Id: I51b1a214dbab2101ae704954727acf0219eb1604 Reviewed-by: Fabian Kosmale --- src/corelib/io/qdebug_p.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qdebug_p.h b/src/corelib/io/qdebug_p.h index 1ca632338f..9dbdd761f9 100644 --- a/src/corelib/io/qdebug_p.h +++ b/src/corelib/io/qdebug_p.h @@ -114,11 +114,10 @@ static inline void formatNonNullQEnum(QDebug &debug, const char *prefix, QEnum v template static inline void formatQFlags(QDebug &debug, const QFlags &value) { - const QMetaObject *metaObject = qt_getEnumMetaObject(Enum()); - const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(Enum()))); + const QMetaEnum me = QMetaEnum::fromType>(); const QDebugStateSaver saver(debug); debug.noquote(); - debug << me.valueToKeys(value); + debug << me.valueToKeys(value.toInt()); } template