From 7c59afe361aeb7dee94b9d0093420e6133b8c434 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 15 Dec 2023 16:40:30 +0100 Subject: QJSValue: document that isUrl only returns true for JS URL objects It does not return true for a QJSValue that carries a QVariant with a QUrl. However, on the C++ side the caller will want the URL value anyway as a QUrl, and in both cases, going through the QVariant works for that. Fixes: QTBUG-119794 Pick-to: 6.7 6.6 6.5 Change-Id: I90fd4a1a27d4dd4758b1060205ce2aeec730eb72 Reviewed-by: Fabian Kosmale Reviewed-by: Ulf Hermann --- src/qml/jsapi/qjsvalue.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/qml/jsapi') diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index dd3bb98002..bc75526e8d 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -372,8 +372,11 @@ bool QJSValue::isError() const } /*! - Returns true if this QJSValue is an object of the URL class; + Returns true if this QJSValue is an object of the URL JavaScript class; otherwise returns false. + + \note For a QJSValue that contains a QUrl, this function returns false. + However, \c{toVariant().value()} works in both cases. */ bool QJSValue::isUrl() const { -- cgit v1.2.3