summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix mismatched enum warnings in QMetaObjectPublisher::unwrapVariantJüri Valdmann2020-09-091-2/+2
| | | | | | | | | | | | | | | | | | | | This method is switching on the enum QVariant::Type using values from the enum QMetaType::Type and the compiler thinks this is not very nice. The warning is not serious since QVariant::Type is defined in terms of QMetaType::Type. Change-Id: Iaff7fe1ea702c6dfc77a008283a6f07cedb2729f Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Fix infinite recursion when wrapping a self-contained object twiceArno Rehn2020-08-172-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous unit test for self-contained objects only wrapped the test object once. After wrapping, a different code path is taken which still exhibited infinite recursion. This patch addresses both the unit test and the infinite recursion. To fix the problem, a boolean in the ObjectInfo struct is toggled to indicate whether the object in question is currently being wrapped. If that is the case, the recursing code path is skipped. [ChangeLog][General] Fixed infinite recursion when dealing with self contained objects. Fixes: QTBUG-84007 Pick-to: 5.15 Change-Id: Ie0898fb5f28cec91587897835ff937672d60f2a1 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Use QList instead of QVectorJarek Kobus2020-06-295-13/+13
| | | | | | | | | | | | Task-number: QTBUG-84469 Change-Id: Ide3fa7a558b456354703dd7fd5ee414647e24934 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* | Add missing overrideAlexander Volkov2020-06-141-1/+1
| | | | | | | | | | Change-Id: I808f3e679cc977dbe8b098c19cf07d1b20c76357 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-05-141-2/+11
|\ \ | | | | | | | | | Change-Id: I6417958acf66455b993c65f51b58f15955aa95f4
| * | Fix deprecation warningVolker Hilsheimer2020-04-161-1/+1
| | | | | | | | | | | | | | | Change-Id: Ieb3f0ef5e5b752613d664731e250dba14fb42f0a Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
| * | Restore compatibility with custom QVariantList/QVariantMap convertersMilian Wolff2020-04-151-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QVariant::toValue<QVariantList> does not honor explicit custom converters for a sequentially iterable container to a QVariantList. This breaks compatibility with Qt 5.12.3 and before, where the old code path using QVariant::toList() used the custom converter. Do the same for QVariantMap. This patch restores the compatibility with old code. The real fix will target the QVariantList converter code in QtCore - this is just a hotfix within Qt WebChannel for now. Task-number: QTBUG-80751 Change-Id: Ic70c6a353aad43ddbaefbc6626a0af87bd0d024f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Minor style cleanupAllan Sandfeld Jensen2020-05-071-2/+2
| | | | | | | | | | | | | | | Change-Id: Id479b97550306418df3b8635a58631cf4429defd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-031-1/+1
|\ \ \ | |/ / | | | | | | Change-Id: I63c62cde3c4eb01b22faca529e23b80200a71bab
| * | Update plugins.qmltypes for 5.15v5.15.0-beta4v5.15.0-beta3v5.15.0-beta2Jani Heikkinen2020-02-251-1/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-82253 Change-Id: I35086c430e4ba87242b2e90c8359ce2fad54e553 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-081-2/+2
|\ \ \ | |/ / | | | | | | Change-Id: I3c9a4bebb89a5b934273a08a18f649fa567276ac
| * | Fix documentation to use commonly working syntax for property changesMilian Wolff2020-02-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "on" prefix and capitalization of the first letter in the change signal name is only done in QML, not in JavaScript. Furthermore, not all notify signals carry the new value in their signature. Adapt the example code to not show the "on" prefix and also use the more reliable approach to read a property value directly. Task-number: QTBUG-81782 Change-Id: I9c25e48c2d7abcdabbca88526f62c3d79eb952f8 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-121-1/+1
|\ \ \ | |/ / | | | | | | Change-Id: I4c43b18f724ef1bceecbb59e2c51de9051df5a76
| * | Update plugins.qmltypes for 5.14v5.14.0-beta3v5.14.0-beta2v5.14.0-beta1Kai Koehne2019-09-271-1/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-78690 Change-Id: Id5357073a90b77450ea4d69125432d7cde390b54 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Merge remote-tracking branch 'origin/wip/qt6' into devSimon Hausmann2019-10-042-3/+4
|\ \ \ | | |/ | |/| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I65d3dcf8373137f14476cf37d2d2119de006a917
| * | Fix Qt6 buildwip/qt6Alexandru Croitor2019-08-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify all the qmlRegisterModule calls to use minor version 15 because minor version zero from 6.0.0 would make tests fail. This is similar to what was done in qtdeclarative in c147b20a2c1299b2d659fe7c9472ae3866b6a425. Change-Id: I1a59d179d4b547bd8050f31a3edfef660db442be Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Bump Qt version to Qt 6Alexandru Croitor2019-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Also fix usage of text stream operators. Change-Id: I5cca2a07a8f95d4449a528aa0e8ca98c94dda40c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-09-241-0/+1
|\ \ \ | | |/ | |/| | | | Change-Id: I08309483943077217f48e9312f23a92fe5b55092
| * | Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-111-0/+1
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I102c309ea3b543a896f2dc13e51b375973974e9e
| | * | Doc: Replace example file lists with links to code.qt.ioTopi Reinio2019-07-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-74391 Change-Id: I8ce0f843469bafa760b14323ce5f36a220e1a7ef Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | | Unwrap QObjects embedded inside argumentsAndrew Webster2019-09-202-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This converts QObjects that are embedded inside ECMAScript objects into the actual QObject that they represent. For example, if an array of QObjects is passed as an argument to a method, the method will received a QVariantList where the items are QVariants of type QObjectStar. Method: void processObjects(const QVariantList &list); Call from ECMAScript: theObj.processObjects([qobj1, qobj2]) Prior to this patch, the method would have received a list containing QVariantMaps with keys from the QObject EMCAScript wrapper (e.g. __objectSignals__, __propertyCache__, etc.). After this patch, it will receive a list containing QVariants with QObject* inside. QVariantMaps are converted to QObjects if they have a property called "__QObject*__" set to true and an "id" property. "__QObject*__" is the same identifier for retuned objects and is now added in a toJSON method at the client. Change-Id: I5cafcddb9df0141977a574aaed4ce7c3ea2d0767 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | | Pack QVariants into args when QVariant is expectedAndrew Webster2019-09-202-0/+5
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a method expects an argument of type QVariant, the argument should actually contain a QVariant as opposed to the converted QVariant value. If the converted value is given, which was the logic before this patch, then some values may not be properly converted back to a QVariant when the method is actually invoked (null for example). For example, if a method signature is as follows: Q_INVOKABLE void test(QVariant value); And it is called from ECMAScript via WebChannel as follows: obj.test(null) Then the argument would have been created as type 'std::nullptr_t' and passed into the method. This results in a QVariant with a random type, which could cause a warning or even a segmentation fault depending on what the type ends up as. Instead, this patch creates the argument as a 'QVariant' which results in the proper type when the method is invoked. Change-Id: I3f75048da1c0f32707f6f162844de74157f0b535 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Correctly link transports to implicitly wrapped objectsArno Rehn2019-07-261-1/+5
| |/ |/| | | | | | | | | | | | | | | | | | | | | When an object is wrapped as consequence of a property update or signal emission, wrapResult() assigns it the parent object's list of transports. It didn't, however, establish the reverse relation, i.e from transport to object. This resulted in dangling pointers after client disconnects and subsequent crashes. This patch fixes the bug. Change-Id: I5d20269c453902bf2883dfcab1f3ab5d0757c2cd Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devMilian Wolff2019-05-281-1/+4
|\ \ | |/ | | | | | | | | | | Conflicts: src/webchannel/qmetaobjectpublisher.cpp Change-Id: I853b8fc7270847c1a9cdd862dff278ddb2533e92
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-181-1/+4
| |\ | | | | | | | | | Change-Id: I182d51367aed4518f5bbc247e4e517af09028f7a
| | * Fix generic conversion of list-like values to JSON arraysArno Rehn2019-05-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, QVariant::toList() was used to convert a QVariant to a QVariantList. This only works for actual QVariantLists and QStringList, however. This patch uses QVariant::value<QVariantList>() which works in all cases. A better approach would be to extract a QSequentialIterable, but QTBUG-42016 currently prevents this. Change-Id: I732cc88a6db2ec5d990760364a9db98a52521f6b Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-135-9/+12
|\ \ \ | |/ / | | | | | | Change-Id: I8b70f062015311e0e3827fe001155d6ce1e146d2
| * | Automatically register the latest import versionv5.13.0-beta3Kai Koehne2019-04-125-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows what was done in d28c9f6a for Qt Quick Controls 2. The latest import version (e.g. 1.14 in Qt 5.14) will automatically be registered whenever the Qt version is bumped. This avoids needing to wait until a new type is added (or a new revision is added to an existing type) before being able to use the newest Qt Quick version. Change-Id: I2570c2bc50c629101adb763e5e5f90bc3ded8bac Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-303-4/+7
|\ \ \ | |/ / | | | | | | Change-Id: Ida698daaae6d184137358ee49fa2d27b6654d8b3
| * | Update plugins.qmltypes for Qt 5.13Kai Koehne2019-03-262-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-73739 Change-Id: I475d01064a76d73641ac8717cc51133863d22507 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Doc: Fix some qdoc errorsNico Vertriest2019-03-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | - add documentation to parameter \a objects - correct link to example code Change-Id: Idedfd749dad01315ee0073ca5a87399b9fa30d70 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Implement actual overload resolutionArno Rehn2019-03-293-14/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements host-side overload resolution. If a client invokes a method by its name instead of its id, the overload resolution tries to find the best match for the given arguments. The JavaScript client implementation now defaults to invocation-by-name, except when a method is invoked by its full signature. In that case, the invocation is still performed by method id. Change-Id: I09f12bdbfee2e84ff66a1454608468113f96e3ed Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Always rebuild the class info for wrapped objectsMilian Wolff2019-03-252-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a new transport is accessing a previously wrapped object, we used to send potentially outdated property values. [ChangeLog][QWebChannel][General] Send current property values when another transport is accessing a previously wrapped object. Fixes: QTBUG-62388 Change-Id: I5cd5772b42c3cb9860e945bb85f77f0e3b6d6ea0 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Publish overloaded methods and signals to JavaScriptMilian Wolff2019-03-252-13/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we only published the first method or signal of any given name. We keep this behavior for the nice JavaScript notation that looks like a normal JavaScript method call `foo.bar(...)`. When you need to call a different overloaded method, this patch offers you to specify the explicit signature on the JavaScript side. I.e. when we have an object with `foo(int i)` and `foo(const QString &str, int i)`, then on the JavaScript a call to `obj.foo(...)` will always call the first method like before. But now you can specify the full QMetaMethod signature and call matching methods explicitly via `obj["foo(int)"]` or `obj["foo(QString,int)"]`. Automatic overload resolution on the C++ side for the nice notation cannot easily be implemented: We need to know the return value of the called function, otherwise we cannot construct a valid QGenericReturnArgument. Furthermore, we wouldn't be able to differentiate between e.g. any numeric types on the C++ side, since JavaScript only has a single `double` type internally. [ChangeLog][QWebChannel][General] It is now possible to explicitly call overloaded methods or connect to overloaded signals by specifying the full method or signal signature in string form on the JavaScript side. Fixes: QTBUG-73010 Change-Id: I4645edee97af56fd8d126e77d70dc33ed3513deb Reviewed-by: Arno Rehn <a.rehn@menlosystems.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-261-0/+3
|\ \ \ | |/ / | | | | | | Change-Id: Ife028425ea8c14d972c2df59071a9333352af7d1
| * | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta1Liang Qi2019-02-251-0/+3
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | Conflicts: src/webchannel/qmetaobjectpublisher.cpp Done-With: Arno Rehn <a.rehn@menlosystems.com> Change-Id: I763a76cf055547c5c5e59511ded51c467d6c7526
| | * Also add already wrapped objects to the transport-to-objects mapArno Rehn2019-02-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a crash: Previously, when a connection was closed, the transport was not removed from the list of transports of a wrapped objects. This was because the transport was not added to the transport-to-object map in the first place. When a property update was pushed, the now dangling pointer to the "old" transport caused a crash. Change-Id: Ib980f0b874851f8f85f7a3d76d51a2c884504b96 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| | * Correctly unwrap registered objectsArno Rehn2019-02-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, only implicitly wrapped objects have been successfully unwrapped. "Officially" registered objects were not, and thus could not be passed to properties or as method arguments. Change-Id: I6b8644ed3be8db3a66c2c1d5bc167fc33a0b4165 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Convert QObjects in QVariantMapsAndrew Webster2019-02-062-0/+20
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QObjects that are present in an array are already converted to an object identifier. This does the same for variant maps, which end up as ECMAScript objects. This allows QObjects put into a QVariantMap to be properly deserialized. For example, if a property is declared as such: Q_PROPERTY(QVariantMap propName READ propName CONSTANT) And propName is: QVariantMap propName() const { QVariantMap map; map.insert("theProperty", QVariant::fromValue(someQObject)); return map; } The "theProperty" property will now properly refer to the object. Change-Id: I3c6e71b860f6825a31eb337aeffa55302287c8ff Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-alpha1Qt Forward Merge Bot2019-02-021-5/+34
|\ \ | |/ | | | | Change-Id: I6b83cc26dddfafe3bebe1bfb3640e2daf2d9a8fb
| * Correctly convert enums and QFlags from and to JSONArno Rehn2019-01-311-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, enums declared with Q_ENUM were stringified in the conversion to JSON and QFlags did not work at all. The conversion of QJsonValue(int) to enum worked fine, however. This patch implements some extra logic for detecting enums and QFlags, thus correctly converting to and from integers. [ChangeLog] Enum values and QFlags are now correctly converted to and from integers in the JS interface Fixes: QTBUG-72924 Change-Id: I23d4a1120b805201c8d450edbd990aad5ad258a2 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| * Remove warning when the notify signal has more than one argumentArno Rehn2019-01-231-5/+0
| | | | | | | | | | | | | | | | | | The warning was not meaningful, since nothing depends on the notify signal having only zero or one argument(s). Removing this decreases warning noise in some applications. Change-Id: Ieb716ad9ac51296a1e17899018d4e6190043b8d5 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Prevent crashes by fixing mapping of transport to wrapped objectsMilian Wolff2018-10-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an already-wrapped object was used by a secondary transport, the mapping was not updated. This could then lead to crashes when the transport was destroyed. [ChangeLog][General] Fix crash when wrapped objects are shared across multiple transports. Task-number: QTBUG-62388 Change-Id: I3c3b7302205e10f04695f1a202325704d90950d2 Reviewed-by: Kai Dohmen <psykai1993@googlemail.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Fix UBSAN warning when downcasting partially destroyed objectMilian Wolff2018-10-251-4/+6
|/ | | | | | | | | | | This patch fixes the runtime warning cought by UBSAN: src/webchannel/qwebchannel.cpp:84:96: runtime error: downcast of address 0x6030001b1570 which does not point to an object of type 'QWebChannelAbst Change-Id: I9c78f94bc97961ef69b71ecca8a9301d81feaf3a Reviewed-by: Kai Dohmen <psykai1993@googlemail.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-261-21/+9
|\ | | | | | | Change-Id: I4feece283bd40e002a62ddd2d8186d8bec9a16df
| * Use FDL license for all .qdoc filesKai Koehne2018-05-231-21/+9
| | | | | | | | | | Change-Id: I039e3a47ca2c3889c3272f81fafb3997777881f6 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-191-0/+9
|\ \ | |/ | | | | Change-Id: Ic6bc4e3c041985294d86cb9b2d9bf020310654a6
| * Doc: Add license details to index pageKai Koehne2018-05-141-0/+9
| | | | | | | | | | Change-Id: I7ef0f2d7c760fcb4016e925ae5cd94fc158b53a6 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Remove the code to manually initialize resources in static buildsSimon Hausmann2018-05-011-8/+1
|/ | | | | | | | | After commit be9a56e5e3ced5d0d668fa24e4c65ae928f2e25a in qtbase, this is not needed anymore. Instead the resource system injects the plugin entry point with a reference to all resources. Change-Id: Iffca1036a6dd2928d4eac89762e102f99ce7dd1a Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-3/+9
|\ | | | | | | | | | | | | Conflicts: tests/auto/webchannel/tst_webchannel.h Change-Id: I454c1bbab153405541e7fc41d1389a810b94f2db