diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-03 01:00:05 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-03 12:23:20 +0100 |
commit | 04e3918f0fd0c19ed830d406e1c549a037089cc4 (patch) | |
tree | 8e07ee9c550124b277983542e2ad0f7a791b5276 /src/qml | |
parent | b760d972459fd3b0c41e4c85076fa933ba5c0d1d (diff) | |
parent | 254a56252874b63430701351dcd8c9bef8507353 (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
src/qmlmodels/qqmltableinstancemodel.cpp
src/qmlmodels/qqmltableinstancemodel_p.h
Change-Id: I89339b1cb41ba27fe30c79530859a1c2bfbecc69
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/doc/src/cppintegration/data.qdoc | 19 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 6 |
3 files changed, 27 insertions, 0 deletions
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc index 7c2693508c..0dec7fd66d 100644 --- a/src/qml/doc/src/cppintegration/data.qdoc +++ b/src/qml/doc/src/cppintegration/data.qdoc @@ -197,6 +197,25 @@ type or method parameter, the value can be created as a JavaScript array or object in QML, and is automatically converted to a QVariantList or QVariantMap when it is passed to C++. +Mind that QVariantList and QVariantMap properties of C++ types are stored as +values and cannot be changed in place by QML code. You can only replace the +whole map or list, but not manipulate its contents. The following code does +not work if the property \c l is a QVariantList: + +\code +MyListExposingItem { + l: [1, 2, 3] + Component.onCompleted: l[0] = 10 +} +\endcode + +The following code does work: +\code +MyListExposingItem { + l: [1, 2, 3] + Component.onCompleted: l = [10, 2, 3] +} +\endcode \section2 QDateTime to JavaScript Date diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 86f0d6d83c..1efe09c59f 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -2355,9 +2355,11 @@ int ExecutionEngine::registerExtension() return registrationData()->extensionCount++; } +#if QT_CONFIG(qml_network) QNetworkAccessManager *QV4::detail::getNetworkAccessManager(ExecutionEngine *engine) { return engine->qmlEngine()->networkAccessManager(); } +#endif // qml_network QT_END_NAMESPACE diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index e0025feb00..efe44a324c 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -91,6 +91,7 @@ class PageAllocation; QT_BEGIN_NAMESPACE +#if QT_CONFIG(qml_network) class QNetworkAccessManager; namespace QV4 { @@ -99,6 +100,9 @@ namespace detail { QNetworkAccessManager *getNetworkAccessManager(ExecutionEngine *engine); } } +#else +namespace QV4 { struct QObjectMethod; } +#endif // qml_network // Used to allow a QObject method take and return raw V4 handles without having to expose // 48 in the public API. @@ -355,7 +359,9 @@ public: FunctionObject *getStackFunction() const { return reinterpret_cast<FunctionObject *>(jsObjects + GetStack_Function); } FunctionObject *thrower() const { return reinterpret_cast<FunctionObject *>(jsObjects + ThrowerObject); } +#if QT_CONFIG(qml_network) QNetworkAccessManager* (*networkAccessManager)(ExecutionEngine*) = detail::getNetworkAccessManager; +#endif enum JSStrings { String_Empty, |