diff options
| -rw-r--r-- | .cmake.conf | 2 | ||||
| -rw-r--r-- | dependencies.yaml | 4 | ||||
| -rw-r--r-- | src/plugins/darwin/qdarwinwebview.mm | 26 | ||||
| -rw-r--r-- | tests/auto/qml/qquickwebview/tst_qquickwebview.cpp | 2 |
4 files changed, 29 insertions, 5 deletions
diff --git a/.cmake.conf b/.cmake.conf index 38824f3..faf0514 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1,2 +1,2 @@ -set(QT_REPO_MODULE_VERSION "6.5.6") +set(QT_REPO_MODULE_VERSION "6.5.7") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") diff --git a/dependencies.yaml b/dependencies.yaml index 9548428..e6009de 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,7 +1,7 @@ dependencies: ../tqtc-qtdeclarative: - ref: ff0a47c8f267e905113b82c53af2742027f0eca6 + ref: 4332989bef24c1039c9097db52196f05979f2b72 required: true ../tqtc-qtwebengine: - ref: f0659431bcc86cbbd2de7ca44a6349d0a6650e8a + ref: 14d35642a2bf064df7f2a22002b19e2e410f0208 required: false diff --git a/src/plugins/darwin/qdarwinwebview.mm b/src/plugins/darwin/qdarwinwebview.mm index 4ec9fc1..80b9916 100644 --- a/src/plugins/darwin/qdarwinwebview.mm +++ b/src/plugins/darwin/qdarwinwebview.mm @@ -17,6 +17,8 @@ #include <CoreFoundation/CoreFoundation.h> #include <WebKit/WebKit.h> +#include <QtCore/qjsondocument.h> + #ifdef Q_OS_IOS #import <UIKit/UIKit.h> #import <UIKit/UIGestureRecognizerSubclass.h> @@ -528,7 +530,29 @@ QVariant fromJSValue(id result) if ([result isKindOfClass:[NSDate class]]) return QDateTime::fromNSDate(static_cast<NSDate *>(result)); - // JSValue also supports arrays and dictionaries, but we don't handle that yet + if ([result isKindOfClass:[NSArray class]] + || [result isKindOfClass:[NSDictionary class]]) { + @try { + // Round-trip via JSON, so we don't have to implement conversion + // from NSArray and NSDictionary manually. + + // FIXME: NSJSONSerialization requires that any nested object + // is NSString, NSNumber, NSArray, NSDictionary, or NSNull, so + // nested NSDates are not supported -- meaning we support plain + // NSDate (above), but not in an array or dict. To handle this + // use-case we'd need a manual conversion. + auto jsonData = QByteArray::fromNSData( + [NSJSONSerialization dataWithJSONObject:result options:0 error:nil]); + + QJsonParseError parseError; + auto jsonDocument = QJsonDocument::fromJson(jsonData, &parseError); + if (parseError.error == QJsonParseError::NoError) + return jsonDocument.toVariant(); + } @catch (NSException *) { + return QVariant(); + } + } + return QVariant(); } diff --git a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp index 139dd85..8352144 100644 --- a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp +++ b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp @@ -444,7 +444,7 @@ void tst_QQuickWebView::settings_JS() webView()->settings()->setJavaScriptEnabled(jsEnabled); webView()->setUrl(testUrl); QVERIFY(waitForLoadSucceeded(webView())); - QCOMPARE(webView()->title(), expectedTitle); + QTRY_COMPARE(webView()->title(), expectedTitle); webView()->settings()->setJavaScriptEnabled(wasJsEnabled); } |
