summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2022-03-01 01:00:59 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2022-03-04 01:26:53 +0100
commit742ffd0f47abd8995a02da1b02dd0c8b5bc34706 (patch)
tree06400f4de0b7cf105670e1806b9a6db43451cc17 /src/corelib
parente93bf391fa3df4498da0f3526f4c89dd35637103 (diff)
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>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qdebug_p.h5
1 files 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 <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>