aboutsummaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* 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. Task-number: QTBUG-90820 Change-Id: Iac796ee2dc02215bfe71bddf5931af09426cc47f Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 9b57b22c053591ef263036a5f0be9b558841236f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Switch examples to build as isolated sub-buildsAlexandru Croitor2021-12-151-6/+6
| | | | | | | | Task-number: QTBUG-90820 Change-Id: If6e6713058cfd4f7940e99261eca658ddb604b36 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 7fd5d81261b195de475b436689a59e047bbd73ce) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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. Change-Id: Iaa399b5d36f429d84e8844ec3813a65d729dd03a Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 69cf633cef93b65cad50c180b9099a79ac5539f9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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 Change-Id: I2dab3a0e715d447004aa408476bcfd638599b012 Reviewed-by: Arno Rehn <a.rehn@menlosystems.com> (cherry picked from commit d42770a9fda2e00617e6f4c2452156b9b9cafd03) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-172-2/+2
| | | | | | | | Task-number: QTBUG-95636 Change-Id: I821f412f9dbe11ae99ffd888a7ab2ba415ed9379 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 87a9fb2887bbaee76c5b7ae81fd9d3eb2b3b49a4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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>
* Examples: Use Qt 5 connectKai Koehne2017-08-292-3/+3
| | | | | Change-Id: I33aa6f8244770bf19b45f69cfc62a5469168418d Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use override keywordKai Koehne2017-08-291-1/+1
| | | | | | | Every C++11 compliant compiler has to support it. Change-Id: I143647aaeba6d49f9ab48abaffad0d77a8abbffd Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use signals and slots keywordsKai Koehne2017-08-292-3/+3
| | | | | | | Examples are not compiled with QT_NO_KEYWORDS. Change-Id: I6bff2b4cc46bd53ef2f1879951e59089734a3864 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use nullptrKai Koehne2017-08-293-3/+3
| | | | | Change-Id: I93688ed891e1cdd6815af0ea22507190c34c0bba Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Use canonical include guardsKai Koehne2017-08-292-6/+6
| | | | | Change-Id: I0806cb50a46da19e3538855b348cbdaa2c4f96e1 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Examples: Do not put example code in Qt namespaceKai Koehne2017-08-296-22/+6
| | | | | | | | Instead just wrap forward-declared Qt classes. See also https://wiki.qt.io/Writing_Qt_Examples Change-Id: I3707bb6ee5577e49a6b860e8f1c21b6aaf6405c2 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-07-217-46/+67
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/webchannel/doc/src/index.qdoc src/webchannel/qwebchannelabstracttransport.cpp Overlapping changes to documentation; constructed hybrid. src/webchannel/qmetaobjectpublisher.cpp tests/auto/webchannel/tst_webchannel.cpp tests/auto/webchannel/tst_webchannel.h Both sides made additions; in the same place. Change-Id: Iff12970978b70946dc3e1290841aca2d35c9c1d0
| * Doc: Edit example documentationLeena Miettinen2016-06-027-46/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add images to the examples. - Add instructions for running the examples - Edit for grammar and style - Add dependencies to Qt WebEngine and Qt WebSockets modules - Add a workaround for preventing autolinking of WebChannel, WebEngine and WebSockets to the wrong targets - Use explicit linking where necessary Change-Id: Ia4025284063fa09c9e2a0b2c347ee682bba8a615 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> (cherry picked from commit 01ea92c7c8d77d3d3c10ab1cc4bf4f214aa07126)
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-248-17/+18
|\| | | | | | | Change-Id: Ica9ff8d7142c5bd5328d44505beb8c22b4c21766
| * Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-rc1Liang Qi2016-05-198-17/+18
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I52dc7e8ad7a9ce6fa36ad2d6ce5d8ea29b77b400
| | * make use of COPIESOswald Buddenhagen2016-04-281-12/+4
| | | | | | | | | | | | | | | Change-Id: Ic3979ec70b7ddf7d01d0873c00b7739c5f0ef3c9 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
| | * fix example installsOswald Buddenhagen2016-04-287-5/+14
| | | | | | | | | | | | | | | Change-Id: Iccf9f6e0e9358ba42576fb67a0b356c7414d911e Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
* | | Add QStringLiteralFrank Meerkoetter2016-04-131-1/+1
| | | | | | | | | | | | | | | Change-Id: I38ddf1dd4af4e350a11288eebdfd3c3ee1dc5fe9 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>