aboutsummaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Correct license for documentation filesLucie Gérard2024-04-044-4/+4
| | | | | | | | | | | | According to QUIP-18 [1], all documentation files should be LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I5176507c0ea4e3f8abcd3c3780a86893feba9543 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Correct license for examples filesLucie Gérard2024-04-046-6/+6
| | | | | | | | | | | | | Example takes precedence over build system file type. According to QUIP-18 [1], all examples file should be LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I88aae81aaa676eb526257dfe6ac35e11083848c8 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Make standalone example copy necessary files for HTML clientØystein Heskestad2023-09-191-0/+31
| | | | | | | | | The CMake-file did not copy index.html and qwebchannel.js. Pick-to: 6.6 6.5 Fixes: QTBUG-115779 Change-Id: I3d25e673be6f3fd8f707ccbdc9b4795dc8b66c3d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Add example categories for Qt Webchannel examplesJaishree Vyas2023-08-233-0/+4
| | | | | | | | Task-number: QTBUG-116067 Pick-to: 6.5 6.6 Change-Id: I0f8dd067b21b85e42393ec70543bf85e844979ed Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Exclude chatserver-cpp example for Android buildElias Hautala2023-08-212-1/+5
| | | | | | | | | | Excludes chatserver-cpp example for android build, baecause it can't be built for Android. Task-number: QTBUG-111933 Pick-to: 6.5 6.6 Change-Id: I2e6accdbee41c6261951b303ad8f5f2c9f27a298 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Doc: Update example category namesKai Köhne2023-07-101-1/+1
| | | | | | | | | Make use of new Web Technologies category, which arguably fits better than I/O. Pick-to: 6.5 6.6 Change-Id: I09277975d784f225502d8ce06b6c9f99d1f3989d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Make chatclient-qml example executableØystein Heskestad2023-06-3011-43/+125
| | | | | | | | | | | | This example used to have to be run using the qml application, now it is a stand-alone application. Some changes are made to make it work in Dark Mode and to improve the user experience. The documentation is changed to reflect the changes and it is slightly expanded. Task-number: QTBUG-113000 Pick-to: 6.5 6.6 Change-Id: I65f0db74e5bbf4cb917b4da980a54dd85c14a954 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add wrappers to optionally convert incoming dataØystein Heskestad2022-11-111-1/+44
| | | | | | | | | | | | | | | | | Wrappers can be added as a third argument to WebChannel constructors or by explicitly calling addConverter. They can be added by supplying their name or by supplying a function. If the function is not applicable it must return undefined to proceed to to the next wrapper. Data is transmitted as JSON when sent over the WebChannel. Because JSON does not have a date, type QDateTime objects are sent as ISO 8601 text strings. The "Date" converter converts such strings to ECMAScript Date objects. Fixes: QTBUG-98490 Change-Id: I83bb7476b50838359db5b981f500871142fa41f0 Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-234-4/+4
| | | | | | | Task-number: QTBUG-105718 Change-Id: I99e928ef0cb271ef28692d0936230ecf0fd08392 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-074-0/+12
| | | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I28932fdec21ec9cd2ad33d0ecd7baa7c1e5dcd36 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-1021-1024/+48
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Id704376bd7d5a127ad3e9bf09f9abedcf2b0f498 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Remove .prev_CMakeLists.txtKai Köhne2022-03-221-52/+0
| | | | | | Pick-to: 6.3 Change-Id: I78d6a6b2d245743f1cce18955ed3fc05a054f9fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Improve examples CMakeLists.txtKai Köhne2022-02-174-31/+12
| | | | | | | | | | | | | | | | | | - Remove "# generated from xyz.pro" comment from pro2cmake - Remove "# special case" comments - Remove automatic use of CMAKE_AUTORCC - Only opt into CMAKE_AUTOUIC if .ui files are involved - Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR - Combine multiple find_package(Qt6 ... calls) - use REQUIRED COMPONENTS - sort components alphabetically - Fix wrong indentations - Use (only) one empty line after multi-line commands Pick-to: 6.3 Change-Id: I213a18f08c12e5b2354f02be0ec64bc022bfb23c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Switch examples to build as isolated sub-builds part 2Alexandru Croitor2022-02-051-1/+1
| | | | | | | | | | | | | | | qt_examples_build_begin needs the EXTERNAL_BUILD flag to know that it's safe to build examples as ExternalProjects. It still won't do it in CI until we enable building examples as ExternalProjects for prefix builds. This is preparation for that. Pick-to: 6.2 6.3 Task-number: QTBUG-90820 Change-Id: Iac796ee2dc02215bfe71bddf5931af09426cc47f Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Switch examples to build as isolated sub-buildsAlexandru Croitor2021-12-151-6/+6
| | | | | | | Pick-to: 6.2 6.3 Task-number: QTBUG-90820 Change-Id: If6e6713058cfd4f7940e99261eca658ddb604b36 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add .qmproject file for examples containing .ui.qml filesThomas Hartmann2021-11-161-0/+39
| | | | | | | | | If an example contains ui.qml it should also have a .qmlproject file for Qt Design Studio. Pick-to: 6.2 Change-Id: Iaa399b5d36f429d84e8844ec3813a65d729dd03a Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix QML files in tests and examplesBalazs Egedi2021-09-093-19/+25
| | | | | | | | | | | | - Removed the import versions - Changed the implicitly defined properties in Connections - Ported qmls to Qt6 - Dialog icon support is incomplete, so no icon in Dialog for now Pick-to: 6.2 Pick-to: 6.2.0 Change-Id: I2dab3a0e715d447004aa408476bcfd638599b012 Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-172-2/+2
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I821f412f9dbe11ae99ffd888a7ab2ba415ed9379 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Re-generate CMake project filesJoerg Bornemann2021-03-153-6/+30
| | | | | | Change-Id: I7973833fa7b4000cb8f6e1a1fc0a8c560fe16a3b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/wip/cmake' into devAllan Sandfeld Jensen2021-01-295-0/+148
|\ | | | | | | | | | | | | Regenerating and fixing as needed. Fixes: QTBUG-90661 Change-Id: Ief9f044d4b9ea2ce8130b11031fb93b6e673fbdd
| * Regenerate projectswip/cmakeAlexandru Croitor2019-11-253-2/+46
| | | | | | | | | | | | | | Change-Id: Ibdadef34b1b7d4ea98140feed171c409eb8bafde Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Add cmake supportJüri Valdmann2019-09-234-0/+104
| | | | | | | | | | | | | | Fixes: QTBUG-78190 Change-Id: Ibdfbcb479ce1af6370b9148516cef6f64e7c1abb Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Skip changes made while iterating over connections for emitAndrew Webster2020-02-211-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If changes are made to the connections while iterating over them during an emit, these new changes should be ignored until the next emit. If not, the following things could happen: * newly added connections could be called for the current emit * an existing connection may not be called at all New connections added to the list are already ignored because forEach caches the length before processing an array. However, if an item is removed during forEach, the current index is not adjusted, which will result in next item being skipped if the removed item is before the current index. This is dealt with by creating a new list during disconnect with the diconnected item removed. This way the list that forEach uses is not modified. This logic is slightly different than QObject, which uses a linked list. If handlers A and B have been attached to the same signal, and handler A disconnects handler B, handler B would still be called, even if it was connected after handler A, which is not the case for QObject. A more complex solution may be required if this behavior needs to match QObject. This also removes an error message when disconnect fails to find any matching connection. This more closely matches QObject. Change-Id: Ief04426a962362055022f450d9767d4b5fe152a1 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-141-1/+1
|\ \ | | | | | | | | | Change-Id: I869a1681af76b2591e84e905a2e376507693b6e4
| * | Doc: Remove linking to example source fileTopi Reinio2020-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | QDoc no longer treats example file pages as linkable targets. Remove the link command. Fixes: QTBUG-79810 Change-Id: Iac92e8007b7618345031617b8039e300328d21a3 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-263-35/+29
|\| | | | | | | | | | | Change-Id: Ieea84fc74092755b0265a26cfb2a43590fa39757
| * | Avoid using 'for..in' to iterate over collectionsKirill Burtsev2019-11-221-27/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'for..in' construct iterates through enumerable properties meaning that user added properties to default type's prototype (like Array.prototype.first) are also included. Proper usage involves 'hasOwnProperty' but is not as clean and generally discouraged by popular style guides in favor of 'for..of' and 'Object.keys' and higher-order functions like 'forEach'. Adopt them for iteration to fix unexpected property warnings. Fixes: QTBUG-50999 Change-Id: Ia0846b0c5a2c34f5ee6f1dcb82198cb3946a95f1 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
| * | Examples: fix 'nodejs' and 'qwclient' compatibility with 'standalone'Kirill Burtsev2019-11-202-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Amends split of classes from 13294ce605 Fixes: QTBUG-75221 Change-Id: I9491fc59a76974c7a9e4784526ac8c2ba729edd7 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
| * | Example 'qwclient': fix lsObject() output of registered objectsKirill Burtsev2019-11-201-5/+11
| |/ | | | | | | | | | | Change-Id: I6b3f771eea2d92f0c3a7d05eeb13cf0b3d8b1ef4 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* / Unwrap QObjects embedded inside argumentsAndrew Webster2019-09-201-6/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-221-10/+12
|\ | | | | | | Change-Id: Ia830dee20e2674c73551319be153ec3e638b5b0e
| * Doc: Minor text layout editsNico Vertriest2019-06-181-10/+12
| | | | | | | | | | Change-Id: I788cca691fd3a0b4542bad9ef05ef40404a42840 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Return a Promise when no callback is provided for a function callAndrew Webster2019-04-101-0/+16
| | | | | | | | | | | | | | | | | | This returns a Promise if Promise is supported and no callback is provided. The Promise resolves when the function call succeeds, or rejects when it fails. Change-Id: I529f5c2c0ff8997820f3d1b4d4b364cd8521e9b5 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Unwrap property updates in case they are QObjectsAndrew Webster2019-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an object is initialized, QObject properties are properly unwrapped. However, before this patch, updates made to QObject properties were not unwrapped and thus could not be used from ECMAScript. For example, given a property defined as such: Q_PROPERTY(QObject* theProp READ theProp NOTIFY thePropChanged) The property "theProp" is correctly unwrapped when the parent object is created. However, it would not have been unwrapped when "thePropChanged" is emitted. This patch corrects that. Change-Id: If8f67560d9fb2a4bd909d2ab30305ceab30f8d31 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | Implement actual overload resolutionArno Rehn2019-03-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Publish overloaded methods and signals to JavaScriptMilian Wolff2019-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Only connect to signal once per client objectMilian Wolff2019-03-251-3/+10
| | | | | | | | | | | | | | | | | | We only disconnect once when all signals are disconnected, so we should also only connect at most once per signal. Change-Id: Ib3a866c3942bec5e06e3b301315bc83cdb972fab Reviewed-by: Arno Rehn <a.rehn@menlosystems.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Convert QObjects in QVariantMapsAndrew Webster2019-02-061-3/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | 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>
* qmlchatclient: Make main window visible by defaultKai Koehne2017-09-121-0/+1
| | | | | Change-Id: I054299ae46364d37655db76d533432ad84372a7c Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Fix class name in standalone documentationKai Koehne2017-09-121-3/+3
| | | | | | | This amends change 13294ce605751babad0687e63c033436d129e3d2 Change-Id: I1e819a5d952329985741a558aef47e50a4bd5e7e Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Make chatclient-qml designer-friendlyKai Koehne2017-09-124-69/+209
| | | | | Change-Id: Ibebe78a8bf2ec0147ece31c5895a78415f12c855 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* chatclient-qml: Show errors in a dialogKai Koehne2017-09-121-6/+21
| | | | | | | | | If the socket is closed the error was so far written to a non-existing element. Show a modal dialog then, instead. Also, do not make the login window visible until we have established a connection. Change-Id: I5045f8583a396f22b751e65b8bb73c609b51c9be Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Give example a meaningful window titleKai Koehne2017-09-121-1/+1
| | | | | Change-Id: Id4e4cabe429f00360d1f357183cfbe0ac1ebb5ef Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Chatclient-qml: Use QtQuick.Controls 2Kai Koehne2017-09-121-1/+1
| | | | | | | Let's promote the newer version also in the examples. Change-Id: I903e2aab0bff6fa397c5d35d44b88ee947851f58 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Beautify code of qmlchatclient exampleKai Koehne2017-09-121-50/+68
| | | | | | | | | Follow http://doc.qt.io/qt-5/qml-codingconventions.html This does not change behavior. Change-Id: Ic0e9aa20e9954cd459c4e0b59b67eadcaebd4e47 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: beautify JavaScript snippetsKai Koehne2017-09-085-65/+69
| | | | | Change-Id: I3499bfa49e79ed3664d020f7de0e691afeb15a86 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Split up classes in standalone exampleKai Koehne2017-09-086-71/+267
| | | | | Change-Id: Ie58e8914415f42b0b4d52106b343e152ba9e7565 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use canonical include style and sort #includeKai Koehne2017-09-066-19/+15
| | | | | | | See also https://wiki.qt.io/Writing_Qt_Examples Change-Id: Ife2300b9f1a074e9dc418d53f8c47138129b0cc7 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Allow examples to be built without module sourcesKai Koehne2017-09-062-9/+432
| | | | | | | | | | | | | | | | | | | | | | qwebchannel.js is used by examples, which so far tried to copy it directly from the library source directory. However, in the case of an installed prefix build of Qt, the library sources are not available. This patches therefore moves the qwebchannel.js file to the examples directory, which is installed including sources. The obvious alternative would be copying the file inside the source tree, but that causes code duplication and a maintenance burden that we want to avoid. Another alternative would have been to install qwebchannel.js into QT_INSTALL_DATA, or extract the file at build time from the Qt library. However, this requires bigger changes, and is also dubious because the use case are in particular applications _not_ using Qt. Task-number: QTBUG-57654 Change-Id: I96bc93b6e3d248e4b4facdd582d9fa53ae562924 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Fix coding style issuesKai Koehne2017-08-293-11/+11
| | | | | Change-Id: Ifdd0a9117bc354c342728949e45d1ac431495ef4 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>