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 <fabian.kosmale@qt.io>
This commit is contained in:
parent
e93bf391fa
commit
742ffd0f47
@ -114,11 +114,10 @@ static inline void formatNonNullQEnum(QDebug &debug, const char *prefix, QEnum v
|
||||
template <class Enum>
|
||||
static inline void formatQFlags(QDebug &debug, const QFlags<Enum> &value)
|
||||
{
|
||||
const QMetaObject *metaObject = qt_getEnumMetaObject(Enum());
|
||||
const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(Enum())));
|
||||
const QMetaEnum me = QMetaEnum::fromType<QFlags<Enum>>();
|
||||
const QDebugStateSaver saver(debug);
|
||||
debug.noquote();
|
||||
debug << me.valueToKeys(value);
|
||||
debug << me.valueToKeys(value.toInt());
|
||||
}
|
||||
|
||||
template <class Enum>
|
||||
|
Loading…
Reference in New Issue
Block a user