aboutsummaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Document the Pointer Handlers exampleShawn Rutledge2023-03-1510-0/+184
| | | | | | | | | | | | Animated gifs were captured with byzanz-record, then converted to webp: gif2webp -lossy -min_size -q 40 -m 6 -mt -metadata none in.gif -o out.webp Fixes: QTBUG-96915 Change-Id: Iee2f4ef774de7862d93c7e4cdf7b2b5e0553bec4 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 024794255d7d1df10fa5239cb70212c9703ff60f) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use SequentialAnimation.loops in FlashAnimation in handlers exampleShawn Rutledge2023-02-211-7/+1
| | | | | | | | | It looks less tedious. Amends 8503f884bbdb50c4bebc8f8a9fce05275b0612b1 Change-Id: I85690e6a8ceac4ebec1c00bcbbf6a81108096e6c Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 40e2811843b3dc414d48f2221e2dee888b448b9b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Examples: Update custom QSGMaterialShader correctlySze Howe Koh2023-01-041-0/+1
| | | | | | | Change-Id: I469c4f813f006ca47f9660a0c9ccfa30bbe89dc6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit f92a2a679886b09ff03e9d70d1bf1269f421347a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* map example: don't restrict pinch-zoom to centerShawn Rutledge2023-01-031-2/+0
| | | | | | | | | | | A big advantage of PinchHandler over PinchArea is the ability to zoom into a particular location in the target Item, so let's not fail to show that off. Change-Id: I0f22abff99bdc60bac27e72fd5f66be4796794df Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit e39b4572c272f8a0a7be048a24808cb028480e82) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QmlExamples: Add missing dependencies of QtQuick in CMakeListsSemih Yavuz2022-11-0915-19/+25
| | | | | | | | | | | | | Running qmllint on extending-qml examples raises a plenty of warnings due to a missing dependency declaration to QtQuick. Simply add it. Also add FINAL to all properties exposed from C++ to disable (possible) property shadowings. Fixes: QTBUG-106602 Change-Id: I7b12a804f8f3ca64bd8f2f312a9e53dfe02b0a4c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 826cf9bb808999d9b49f8ad53b80a902e8fd7bda) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix texteditor example for AndroidTomi Korpipaa2022-10-212-0/+85
| | | | | | | | Fixes: QTBUG-103939 Change-Id: I60237f8cc58ebb6781a4df272fb7da13467d6640 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 51ddad5ffde6f14f8a826ef57e652e56578afd76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix TypeError in dynamicview1 exampleSami Varanka2022-10-191-1/+1
| | | | | | | | | | | Rectangle's parent was null when setting left and right anchors. Use ListView.view.width as width instead. Fixes: QTBUG-106645 Change-Id: I2a95b05c2fc13843168d9b314bfe9555d92768aa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* SEO-enhance attached property documentationFabian Kosmale2022-10-121-0/+6
| | | | | | | | | | | | | Currently, it's rather hard to find the documentation on how to write attached properties. The page that gets found first in most search engines seems to be the example - so link from it to the actual documentation pages. Change-Id: I78c9949d62863b5c11ffcd97413084ab03b0bc33 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> (cherry picked from commit 78beaa5ff81ac8b269bfd302d1770df87e29aaa4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Key Interaction Example: revert PropertyChanges to 6.2-styleSami Shalayel2022-09-294-42/+16
| | | | | | | | | | | | | | | Partially reverts commit 1694a4a71d03faf7e952535f9af86f886bb223d4. The 6.3-style of doing PropertyChanges (using grouped properties) for the key interaction example has been accidently picked back to 6.2. This leads to broken behaviors and crashes: partially revert the PropertyChanges to the old syntax. Fixes: QTBUG-106883 Change-Id: I6457f8057c24bec5324cc192f1432f4acccc27c7 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Examples: Fix .pro files for chattutorialBartlomiej Moskal2022-09-166-11/+20
| | | | | | | | | | | | | | | | Chat Tutorial application was not able to find main.qml file when using qmake. It was caused by cmake adaptation for using qt_add_qml_module. The main.qml file is currently searched in the chapter directory. To these changes also qmake configuration must be adapted. Fixes: QTCREATORBUG-27655 Change-Id: I1e92d806dbfeb17e613596f96fd24f53fb6eba1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit a9841877f38223ce81692b437d58a0cf07541da1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* examples/texteditor: remove use of Material styleSamuli Piippo2022-09-141-3/+0
| | | | | | | | | | | | Amend ec582ef0b9e31c5e8fb9d36a17f1e39f593d7455 which removed use of Material as the default style. This cause example to fail when cross-compiled, as it then used different qml file which had dependency to Material style. Fixes: QTBUG-106557 Change-Id: I7f918363a47c801a6755eca38c1c4bc4da2854b6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit a5ced5b63c7fdd2ce83f1fb54c25ae38fbad8246) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* examples: deploy qmldir for plugin exampleSamuli Piippo2022-09-131-0/+2
| | | | | | | | | We need to deploy qmldir to make the example work also for remote targets. Change-Id: Id0b7bf4a48bd163ddf5e44a5a68ca3edbbcc008e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b21290a731876d6c26546b48ab339d36cb873745) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* examples, texteditor: remove the config file, and use default settings insteadRichard Moe Gustavsen2022-08-313-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The qtquickcontrols2.conf file was hard coding the style to be Material. In addition, it was overriding both the Primary and the Foreground color, and sat Theme=System. The latter meant that the application would run in either Light or Dark mode, depending on the OS. And for Dark mode, the assigned colors caused the text to end up with the same color as the background color, and therefore be invisible. The same with the toolbar buttons; since the icon color of a toolbar button map to the primary color, and the primary color was hard-coded to be the same as the background color in the configuration file, the buttons would appear hidden. Since we now have native styles for both macOS and Windows (and Fusion on Linux), overriding the style (and especially the colors) in a config file seems unnecessary. This patch will therefore remove the whole config file, and use the default style settings instead. Fixes: QTBUG-105860 Change-Id: I330fe30746096cf26d8dca343f2c122d7c32c7fe Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit ec582ef0b9e31c5e8fb9d36a17f1e39f593d7455) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Sidebar example: nest content in MouseArea to restore hover propagationShawn Rutledge2022-03-291-5/+5
| | | | | | | | | | | | | | After 499828b855d125ac236917f6ed01d8f1e7d88505 if you want a MouseArea underneath some other contents to receive propagated hover events, the content must be inside the MouseArea, not a sibling. HoverHandler still does not have this restriction (handlers cannot have items as children, and the handler is not considered a sibling: it's an event-handling facet added to the item in which it's declared). Change-Id: I5ac31d982e429ac002cb0bd7ae9c071ab927032b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 864dade139242f8ef8bb208d899fa8264cfb91f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add improvements to object listmodel exampleJani Korteniemi2022-03-252-10/+29
| | | | | | | | | | | | | Scaled to fit whole screen on android. Replaced items with Qt Module names. Randomized colors. Added scrollbar. Task-number: QTBUG-95438 Change-Id: I1686aff4d4770d0d34399f20301c8fc393b8d778 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 9dcd908fb53e65d5dc6e8acc61e883b7b715dc92) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use QSGRendererInterface::OpenGL in documentation and examplesKai Köhne2022-02-1512-12/+12
| | | | | | | | | | | | QSGRendererInterface::OpenGLRhi is only an (undocumented) alias to ...::OpenGL, so let's use that instead. Amends 0b2311a62b25c Change-Id: I4acdd39dc1d9b75bed5c474667a43b4ad86e7f47 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit e2138561df3562c19000af24d43659090c19167a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Drag and Drop example: remove ParentChangeShawn Rutledge2022-01-141-2/+0
| | | | | | | | | | | Reparenting the tile doesn't seem to be needed; and behavior changed somehow in Qt 6. Task-number: QTBUG-99436 Change-Id: If860d62260a7904718eb33b857b339bc6c5557a8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 092b58246087d4eee08b0fe8d682f95b40497b6b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Switch examples to build as isolated sub-buildsAlexandru Croitor2021-12-176-24/+24
| | | | | | | Task-number: QTBUG-90820 Change-Id: I7fab73f63a22901ab2d4d4e57b5a25b433100de5 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 2f45a9c2b9f3a136f6933b6faa8e223a634b28a6)
* Add .qmlproject file for examples containing .ui.qml filesThomas Hartmann2021-11-301-0/+45
| | | | | | | | | | | If an example contains ui.qml it should also have a .qmlproject file for Qt Design Studio. Change-Id: I290838f5bf7c6d295ea7fecb6b1c689ad5b924e1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 84b3e889b8a9b281be6c19f747e4d230163d3909) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix toplevel Qt build (for real this time)Fabian Kosmale2021-11-241-5/+5
| | | | | | | | | | | reused_dir_targets takes a list of targets, not directories, so provide that one. Amends 953c1cf394613fd5977aa4068f45d9d4b6d39662 Fixes: QTBUG-98468 Change-Id: I44e811ff738c5a51845c4829e1e6928e5f2f06f1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 00c352c4d4b61f8c7a6243768bc5375c3dca3e76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Scenegraph examples: Use suffix-less RHI constantsFriedemann Kleint2021-11-243-3/+3
| | | | | | | | | Complements 23dbe3d6e0d3338812ad9f614028a6fdc5a54090. Change-Id: Ic1bda49a888b0580ac483d650b879a9ae843129b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 0b2311a62b25cbc34fd41bf0c9aef7e8327eb923) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix toplevel Qt buildFabian Kosmale2021-11-221-0/+5
| | | | | | | | | | | | | All targets using the "shared" approach need special handling in toplevel builds to ensure that AUTOMOC works. Amends aa4897e017c027c935cd349450bf787393ce5552. Fixes: QTBUG-98468 Change-Id: Ic0a6ee0ab43190e359ad7cfb7e7634d393ff0b03 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 953c1cf394613fd5977aa4068f45d9d4b6d39662) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Rendercontrol example: use new cmake apiOliver Eftevaag2021-11-164-58/+28
| | | | | | | | | | | | Updating the CMakeLists.txt files in the d3d11 and opengl version of the example to use the new qt_add_qml_module() function instead of the old qt_add_resources() Task-number: QTBUG-98130 Change-Id: Ida43e4b0c875951a85d754b3a96f88366b580e24 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 88dfbe0deaa780f1cb5793d644341367d02e3073) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Model examples: use new cmake apiOliver Eftevaag2021-11-1213-79/+43
| | | | | | | | | | | | | | | | | | The models directory contains 3 subdirectories with an example project in each. This patch updates the CMakeLists.txt files to use qt_add_qml_module() instead of the old qt_add_resources(). In order to achieve intercompatibility with both cmake and qmake, I had to do some slight modifications to both the .qrc files and the url path used to set the source to the QQuickView. Task-number: QTBUG-98130 Change-Id: I13d1c01a0eda181823f394bc2a4259ce98abd4f8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit a155b3bc3ee161fbb7ff1760781577700b0aafce) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Keyinteraction example: use qt_add_qml_module() in CMakeLists.txtOliver Eftevaag2021-11-1211-76/+86
| | | | | | | | | | We want to use the new cmake api instead of qt6_add_resources() The file structure has also been flattened a bit. Task-number: QTBUG-98130 Change-Id: I1651d25e2902bf6932b78c2224ee4ffe454b658d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 750e7d946ca8c059151e91c57da243bdc787ea6e)
* MouseArea example: use qt_add_qml_module() and update a signal handlerOliver Eftevaag2021-11-123-30/+15
| | | | | | | | | | | | | | | Thing patch updates the CMakeLists.txt file to use qt_add_qml_module() instead of qt6_add_resource(). Additionally, it changes a signal handler, which was previously a plain statement, into a js function, which is the preferred way to write signal handlers. Task-number: QTBUG-98130 Change-Id: I1b08dcd3eae370d78587aa3d37d9456437b54b42 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 28bfd773cac84d228df9e6bdcc9bed84d79935c5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Particle examples: use new cmake apiOliver Eftevaag2021-11-1299-1196/+427
| | | | | | | | | | | | | | | | | | | | | | | | | The particles directory contains 5 different examples and a shared directory with some images files. This patch changes the examples to use qt_add_qml_module() in the CMakeLists.txt project files, and changes the .qrc files to directory reference the files needed by the individual projects, which removes the need for images.qrc. (The .pro files still reference the shared.qrc file) The "content" directories located in the different example projects, have been removed, and the containing files have simply been moved to the parent directories instead. Some unused files in the itemparticle example have also been deleted. This example looks very outdated and should ideally be improved, or perhaps simply removed, but I decided to leave it for now. Task-number: QTBUG-98130 Change-Id: If05986b4347814715bca50b8d3f6a5cddbf9ced4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit aa4897e017c027c935cd349450bf787393ce5552)
* Embeddedinwidgets example: use qt_add_qml_module()Oliver Eftevaag2021-11-111-33/+11
| | | | | | | | | | We want to use the new cmake api, rather than qt6_add_resources() Task-number: QTBUG-98130 Change-Id: I567aec77b963adce03fb683c244d758880891ce5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit fb264129529dc39cf94bc3e69ef14cc08d26df78) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* painteditem: better error message when running cmake on textballoonOliver Eftevaag2021-11-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | Building the TextBalloon in isolation doesn't make any sense. Its purpose is to implement a delegate, for the painteditem example to use, and should therefore only be built as part of the painteditem project. To build the example, cmake should be invoked with examples/quick/customitems/painteditem/CMakeLists.txt as its source path. The CMakeLists.txt in examples/quick/customitems/painteditem/TextBalloon should only be used from another CMakeLists.txt file via the add_subdirectory() command. If invoked directly it makes sense to print an error message and stop processing. Task-number: QTBUG-96806 Change-Id: I1ebd2157790afbf7307498a4fb64049794ae6c5b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit fe59c788a65579bbeeb550fcad96cf26443df77a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix CMakeLists.txts of chattutorialMitch Curtis2021-11-11110-528/+521
| | | | | | | | | | | | | | | | | | - Run pro2cmake.py on each .pro and did some manual adjustments. - Rename directories to simplify resource paths, URIs, etc. - Rename executables to ensure they're distinguishable from other targets in Creator's locator. - Duplicate images into each example due to issues with resources. - Now that we use qt_add_qml_module, the qtquickcontrols2.conf file will no longer be at the resource root, so specify it separately with qt6_add_resources. - Update qmake files. - Fix documentation. Task-number: QTBUG-98130 Change-Id: I210ef2cbcd45dd7f4df881332174bff1b18c5be7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 5e8e12b342657b9dabffd86e7f2b0d1ae194bd54)
* Polish the QML reference examplesFriedemann Kleint2021-11-0453-474/+285
| | | | | | | | | | | | | | - Use member initialization, which allows for using constructors from the base classes - Use qsizetype for indexes - Use qInfo() instead of qWarning() for printing - Add spaces/fix formatting Change-Id: Iebce1b810ce00f29395207d93303363b3b71e52e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit c442ed4d65b0319e4abd7a931cfb2f1f72842b84) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix indentation in positioners exampleIvan Tkachenko2021-10-281-14/+14
| | | | | | | Change-Id: I5a39ba9361503cd5d7ce2e6da59d7807d540bee5 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit e4308747d3a27a5b942c5b79fcbb77f7b327ae67) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove import versions from qml files in the pointerhandlers exampleShawn Rutledge2021-10-2715-17/+17
| | | | | | | | | | | | Many of these are portable to Qt 5; but we don't need the version numbers in Qt 6, and the components that use "palette" refer to Item.palette, which was added in Qt 6. Change-Id: Ic799fba5dd66db51a8808c52dce01d27c6da62bb Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit cc18223e0b7bb6677e649ffa42b043d327f9c7f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pointerhandlers example: fix CMakeLists.txt linking errorOliver Eftevaag2021-10-261-5/+6
| | | | | | | | | Fixes: QTBUG-97466 Change-Id: I9bb0b79b12cbd43209f56137bbdb67ca2457ca6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit e2532e8773e0ee123d2b27e978026386b7ebc19d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove deprecated usage of QQmlFileSelector::get in texteditor exampleLuca Di Sera2021-10-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The text editor example adds a "touch" file selector to the qml engine that is used for the application such as to be able to provide an interface for touch based devices. The extra selectors were added by retrieving the engine's file selector trough QQmlFileSelector::get, which was deprecated in Qt 6.0, see commit 75563fa761b94e049de0a29e91591610b0d15745. This resulted in a deprecation warning when the example was built. To avoid the warning and the use of deprecated methods in examples, the example was modified to use the suggested replacement, `QQmlApplicationEngine::setExtraFileSelectors`. A line suggesting the use of the deprecated method was removed from `QQmlFileSelector`'s documentaton page. Fixes: QTBUG-97462 Change-Id: I6ee0306647fe16e75c2cd72f3b37be6c7c5f9261 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 325938018be24fa54b2d06d9e16b040a925580f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* chattutorial: fix build without SQLMitch Curtis2021-10-151-2/+5
| | | | | | | Change-Id: I68d1a2c42cde55ed9d370411943c2cb006355186 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit f60e514300758540976c5e09e79aaa3ced1a922d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* DragAndDrop example: Update CMakeLists.txtOliver Eftevaag2021-10-064-61/+31
| | | | | | | | | | This commit updates the drag and drop example to use qt_add_qml_module() in its CMakeLists.txt file. Change-Id: I47fd28a1a114fe70986f73d4f2d87265255652a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit b128136f80d7e456d2c779750a4e39d4168cf204) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix wrongly copy-pasted dependency in exampleAlexandru Croitor2021-10-011-1/+1
| | | | | | | | | | Amends edc4357ae4893dd952ce1c07b180b4b334047606 Task-number: QTBUG-96805 Change-Id: Iedbf372cd94b1b04db55685a5d05daca491200fe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit d5e8a697f8b33b3fb7671b97429c4e10ae345b91) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix textballoon example when using a shared Qt on macOSAlexandru Croitor2021-09-301-0/+8
| | | | | | | | | | | | | | | | Copy the qml plugin into the macOS app bundle just like we do for the examples that use the 'shared' project using the new add_qml_module_to_macos_app_bundle helper function. Amends 79cae5f6522bc259caa27b98031bfe84ef936744 Fixes: QTBUG-96805 Change-Id: Ib22131a15f0cd06a7888ec991f5ec9f79045d202 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 73d8a2c01667d1c1ac11d5bf0121b3a144ceb5f1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Refactor bundle_shared into a more reusable functionAlexandru Croitor2021-09-302-25/+37
| | | | | | | | | | | | | | | | | | | | Refactor the logic of bundle_shared into a more reusable add_qml_module_to_macos_app_bundle function that can be used in QtQuick examples that need to bundle the qml plugin on macOS, but don't use the 'shared' qml module plugin. The new function is placed in a QtBundleQmlModuleForMacOS.cmake file which can be included separately from the shared/CMakeLists.txt project. Amends 633a85cd39cdd294283439972cffebcff32ac0cb Task-number: QTBUG-96805 Change-Id: Iebb3f4734b9a6bd8a8316bf5ae01d9740c442645 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 7ab424a5cd7790dd87eabd68c294d38662aca8fe)
* CMake: Fix textballoon example when using a static QtAlexandru Croitor2021-09-302-2/+1
| | | | | | | | | | | | | | | | Don't pre-create a qml module backing library, don't link to it directly and instead rely on regular qml plugin loading. This avoids undefined linker errors. Amends 79cae5f6522bc259caa27b98031bfe84ef936744 Fixes: QTBUG-96805 Change-Id: I77acd086257e27e1933e9b36d7f0212765afceb3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit d73f98b1b560ce9776250f0a81c37682de0c8190) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix examples that use 'shared' project when using a static QtAlexandru Croitor2021-09-309-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using a static Qt, linking of examples that use the 'shared' Qml module would fail with the following error Undefined symbols for architecture x86_64: "qt_static_plugin_sharedPlugin()", referenced from: StaticsharedPluginPluginInstance::StaticsharedPluginPluginInstance() in window_shared_init.cpp.o This happened because the 'shared' project pre-created its plugin target with qt_add_library instead of qt_add_plugin. qt_add_plugin passes an additional QT_STATICPLUGIN compile definition when compiling the moc'ed file to ensure that the QT_MOC_EXPORT_PLUGIN macro creates a qt_plugin_instance_PLUGIN_NAME symbol. Unfortunately we can't use qt_add_plugin for shared Qt builds, because some of the projects link directly against the plugin target and it's not possible to link against a MODULE_LIBRARY target which qt_add_plugin creates in shared Qt build. We could try to conditionally switch between using qt_add_library for a shared Qt build and qt_add_plugin for a static Qt build, but that further complicates the build system code because it requires specifying a class name and plugin type explicitly. Remove the direct linkage against the libraries in the examples and instead rely on plugin loading. This simplifies the logic of not having to pre-create a target. Amends 7b6eea37aeea55cdf1bcb1fd9c3091d6753f95e8 Fixes: QTBUG-96805 Change-Id: I5b2f3992ccda29b59f1e99748005381c73daca69 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit edc4357ae4893dd952ce1c07b180b4b334047606) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Ensure proper dependencies in bundle_sharedAlexandru Croitor2021-09-301-0/+4
| | | | | | | | | | | | Ensure the shared qml module is built before it is bundled into the app's bundle dir on macOS. Change-Id: I0b93fc54d1caa86070335347f5d2735eafe6819a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 2a04bfaf3a2054222cc8a508ecd11727f2b2269b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix delegatechooser example to use QML modulesUlf Hermann2021-09-304-57/+22
| | | | | | | | | | | We need to rephrase the image source selection due to ListElement only accepting literals. We can't just poke into the qrc file system of the "shared" module without importing it. Change-Id: I54d3fa4daf304afc9a0a55ab8b590d9c5ad20aa2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 485416c9d57e8ff8fe4fc0f7f4a3c4fdeaf35e98) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* doc: Replace qmlscene with qmlShawn Rutledge2021-09-302-4/+5
| | | | | | | | | | | We deprecated qmlscene in a9c93e2716a097c637515aded49a3308e257204b so we should stop recommending it in docs, too. Task-number: QTBUG-53219 Change-Id: Ic729624a8ef849bd13f38087e20b5a410c5c5756 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 0c4851e12b9ec42fddbb64a9f86003a435644f80) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* TextEditor: Clean up example and use quick dialogsOliver Eftevaag2021-09-296-222/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The text editor example is dependent on Qt.labs for its dialogs and native menus. The long term goal is to remove the Qt.labs dependency, and replace it with components from QtQuick. Currently we have a file and a font dialog, that should be used instead of the Qt.labs dialogs. I'm also replacing some of the properties in the DocumentHandler, since I don't think it makes sense for the font to be limited to only a few font weights and styles (which can be selected through the font dialog). Selecting the most common font weight and style is still possible using the bold and italic shortcuts and toolbar buttons. Some more features includes: * An additional toolbar button, which can be used to strikeout the selected font. This required adding an additional glyph to fontello.ttf. * When coupled with the fix for QTBUG-96934, the font for the current selection should automatically update the listviews in the font dialog to select the correct family, style, sizes and effects for what is selected in the document handler. Fixes: QTBUG-95976 Change-Id: I2907a2270e2a139b1ccb3fcb3ce3a788306a42e3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit cba55a2f08b59a378e721077d03e871f291301fb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix ImageElements example to use a QML moduleOliver Eftevaag2021-09-2927-116/+81
| | | | | | | | | | | | Removed the 'content' directory, and placed all images into a 'pics' directory. CMakeLists.txt is now also using qt_add_qml_module() Change-Id: I673b7adea1832f304003f95e171118b0822b3c83 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 34bc389543c37b8439c9c0b48f471649b6529868) Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move most of the pointer manual tests to a new pointerhandlers exampleShawn Rutledge2021-09-2946-0/+3263
| | | | | | | | | | | | | | | | | | | | | | | They were always meant to be examples eventually. Now they will be used for an example of how to implement custom controls using only basic items and handlers. Some components are very similar to those in the shared directory; but most examples will use Qt Quick Controls, so those shared components can be removed when we no longer use them. This example should remain as the one that shows how to build reusable controls "from scratch". Removed InputInspector because it's inefficient, has limited usefulness, tends to require building the manual test to be able to run it, and could be better built as a reusable Qt.labs component later on, providing a model with all known devices and taking advantage of the QPointingDevice::grabChanged signal to track the grab states rather than polling. Change-Id: I47ab6ebb2cecab07a69cf96e546ffd0db3026a60 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 8503f884bbdb50c4bebc8f8a9fce05275b0612b1)
* Use strict === equality for ScrollBar::orientationIvan Tkachenko2021-09-271-7/+7
| | | | | | | Change-Id: Icaf1bcda4a996cc3348911c87e43c4af2a246d73 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit f5fc1d556da8f225275490cd539795ad8bba9bf2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Shapes interactive example: use Controls canonically; architectureShawn Rutledge2021-09-271-259/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As long as we had the funcs array, it would have been nice to be able to directly get an index from whatever "tool" is selected. For example, TabBar has currentIndex; but TabBar is otherwise not a great fit here. But the funcs array wasn't so elegant anyway. So that prompts switching to the known OO design pattern in which drawing tools are objects containing functions that "do" the drawing, so that there's no conditional dispatch: just ask the tool to handle each mouse state change. I.e. here the DragHandler on the canvas uses the tool's shapeType Component to create the shape, but the DragHandler doesn't have to care which shape it is. Handles for moving the shapes' control points are also shape-agnostic: - a handle is a sort of template taking the path x and y properties to read and write - the handle initializes its position from those properties - the DragHandler inside gets to do what it does best: just drag the handle, nothing else (instead of needing to script the movement of both the handle and the control point, we don't script either one) - declarative bindings on the handle's position update the path properties whenever the handle moves And some styling: - Switch looks better than Button for toggling - use palette colors so that it looks good in dark mode too - fix handle colors getting stuck on yellow - borders on handles (yellow on white makes it hard to see the edge otherwise) - reorder curve types by mathematical order (line, quadratic, cubic) Change-Id: Iefd980f428601840deb55370aad9256748855f07 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit d5fb3c9a61d92bda7830ea3656fc44e83e7beae1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>