diff options
author | Tobias Koenig <[email protected]> | 2014-12-17 13:51:55 +0100 |
---|---|---|
committer | Tobias Koenig <[email protected]> | 2014-12-18 06:29:11 +0100 |
commit | 7c0f21ce044eb39c203e524e5ddde53e25d9ed17 (patch) | |
tree | a05cb1c4890dcec08773834504a30c587d0af4e8 /src/qml/jsruntime/qv4variantobject.cpp | |
parent | 7923f9f570e7d765adfea204a0d9dd7c08c0e58f (diff) |
Fix handling of enum values encapsulated in QVariant
In case a QJSValue contains a QVariant which wrapps an
enum value, the valueOf() method will convert the enum
to an int32.
Change-Id: I0b92207184f343d53f73884245b90552165c34fc
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4variantobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4variantobject.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp index 3e659eec5a..d08d2a0812 100644 --- a/src/qml/jsruntime/qv4variantobject.cpp +++ b/src/qml/jsruntime/qv4variantobject.cpp @@ -174,6 +174,8 @@ QV4::ReturnedValue VariantPrototype::method_valueOf(CallContext *ctx) case QVariant::Bool: return Encode(v.toBool()); default: + if (QMetaType::typeFlags(v.userType()) & QMetaType::IsEnumeration) + return Encode(v.toInt()); break; } } |