diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-02-09 09:56:28 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-03-21 10:41:29 +0100 |
commit | a155476111bb9a16a63131ddbc688a1e02e6c640 (patch) | |
tree | 6a22a3c9c9923c70ed52b7dc1b8a55f0a4c71d6d /src/qml | |
parent | 44fde66f5c8f753931381ed89de924baa21486e4 (diff) |
QJSEngine: Avoid calling QJSValue::isVariant in qjsvalue_cast
We want to deprecate the function. This will also align the QJSValue
overload with the two other overloads we have, and might lead to more
conversions succeeding
Change-Id: I61aab3568f5dbfc786e54f75036d0b047311cd0c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsapi/qjsengine.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/qml/jsapi/qjsengine.h b/src/qml/jsapi/qjsengine.h index 0851bf39ca..b1c99db220 100644 --- a/src/qml/jsapi/qjsengine.h +++ b/src/qml/jsapi/qjsengine.h @@ -359,10 +359,7 @@ T qjsvalue_cast(const QJSValue &value) { if (T t; QJSEngine::convertV2(value, QMetaType::fromType<T>(), &t)) return t; - else if (value.isVariant()) - return qvariant_cast<T>(value.toVariant()); - - return T(); + return qvariant_cast<T>(value.toVariant()); } template<typename T> |