Skip to content

Commit

Permalink
Update QMetaEnum::fromType()'s static assert's error message
Browse files Browse the repository at this point in the history
QMetaEnum fromType() also works for enums declared with Q_{ENUM,FLAG}_NS.
This hadn't been added to the message when we added Q_{ENUM,FLAG}_NS.

Fixes: QTBUG-75829
Change-Id: Ib71dae83dd8d837adf46b73cd299b8e61bdb1f64
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
ediosyncratic committed May 15, 2019
1 parent 6fb2b4b commit 2ed4fcc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/corelib/kernel/qmetaobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ class Q_CORE_EXPORT QMetaEnum

template<typename T> static QMetaEnum fromType() {
Q_STATIC_ASSERT_X(QtPrivate::IsQEnumHelper<T>::Value,
"QMetaEnum::fromType only works with enums declared as Q_ENUM or Q_FLAG");
"QMetaEnum::fromType only works with enums declared as "
"Q_ENUM, Q_ENUM_NS, Q_FLAG or Q_FLAG_NS");
const QMetaObject *metaObject = qt_getEnumMetaObject(T());
const char *name = qt_getEnumName(T());
return metaObject->enumerator(metaObject->indexOfEnumerator(name));
Expand Down

0 comments on commit 2ed4fcc

Please sign in to comment.