Commit a92c7d11 authored by Thomas BOUTROUE's avatar Thomas BOUTROUE

Add fromString/fromByteArray in QML_ENUM_CLASS

parent c302d888
Pipeline #994 passed with stage
in 16 seconds
......@@ -23,6 +23,12 @@
static QString asString (const int value) { \
return QString::fromLatin1 (asByteArray (value)); \
} \
static Type fromByteArray (const QByteArray & str, bool * ok = nullptr) { \
return NAME::Type (staticMetaObject.enumerator (0).keyToValue (str.constData (), ok)); \
} \
static Type fromString (const QString & str, bool * ok = nullptr) { \
return fromByteArray (str.toLatin1 (), ok); \
} \
private: \
NAME (void) = delete; \
NAME (const NAME &) = delete; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment