aboutsummaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Refactor and update qml CMake APICraig Scott2021-06-045-40/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing CMake API for qml modules had a number of shortcomings. Refactor it to achieve the following: - Clearly separate public and internal aspects. - Re-use code from qtbase for adding plugins and module targets rather than reimplementing close variations. - Provide more robust and complete support for qmllint, qmlcachegen and automatic generation of qmldir files. - Reduce the steps needed for more common scenarios. - Encourage the use of separate backing library and plugin targets. - Automatically generate the plugin class .cpp file where possible. - Specify .qml files directly through qml-specific API elements rather than assuming they can be extracted out of a set of resources. [ChangeLog][QtQml] The qml CMake API has changed from 6.1 and is now out of Technical Preview status. The most notable change is that .qml files should no longer be specified as resources, there is dedicated handling for them in the qt6_add_qml_module(). A related change is that the qt6_target_qml_files() command has been replaced by qt6_target_qml_sources(). More complete integration with qmlcachegen, qmllint and qmldir generation is also part of the CMake API. Fixes: QTBUG-91621 Task-number: QTBUG-82598 Task-number: QTBUG-88763 Task-number: QTBUG-89274 Task-number: QTBUG-91444 Change-Id: I25aae1b0e89890394dfe2ba2824008164b2ca8d9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Switch examples to build as isolated sub-buildsCraig Scott2021-05-2714-80/+75
| | | | | | | Task-number: QTBUG-90820 Change-Id: Id9157526898ba72cb64ee8256639b37357f7bacf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Use fixed qt_add_resource BASE argumentJoerg Bornemann2021-05-2120-1805/+452
| | | | | | | | Pick-to: 6.1 Task-number: QTBUG-86726 Change-Id: If6e1033642d98ccd40daeb57a453c0e5bc2985da Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Enable rendercontrol_d3d11 example for MinGWLaszlo Agocs2021-05-197-15/+8
| | | | | | | | | Pick-to: 6.1 Fixes: QTBUG-92839 Change-Id: Id17417b7ae010566b7f78ea1a6b2cc8fe6abc5e3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* examples/qml/locale: Use inline component as a delegateMaximilian Goldstein2021-05-191-11/+17
| | | | | | | | Modernize the code by using an inline component as a delegate in this example file instead of declaring the delegate inline. Change-Id: I52c75f81c42362f858f63bdbbaf432c0966309fe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* examples/quick: Explicitly cast Qt.application to (Quick) ApplicationMaximilian Goldstein2021-05-033-4/+4
| | | | | Change-Id: Ib9ec9eb0e9f47d8ce758a3c93fee2d1a5abb73ac Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* examples: Use template literals for multiline stringsMaximilian Goldstein2021-05-033-20/+20
| | | | | Change-Id: I660a74730edf60d0b7760162b441e3e14749e930 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* examples/quick/text/styledtext-layout.qml: Fix warningsMaximilian Goldstein2021-04-301-3/+3
| | | | | Change-Id: I7c0133d08f306dfb813d02e40f1987e278dd3f4d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* examples: samegame4/BoomBlock.qml: Do not use unqualified accessMaximilian Goldstein2021-04-301-7/+7
| | | | | Change-Id: I6e7d6b82605271478bfba9ff614f5748b58fffb7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* examples/quick/views: Fix a few warningsMaximilian Goldstein2021-04-303-5/+5
| | | | | Change-Id: Iac5df82ff708e37a0cb985e0b83878e7f9b107e1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* make isRightAligned() const and setNoiseSource() const referenceXiao YaoBing2021-03-172-2/+2
| | | | | | | Guessing the const specifier was accidentally forgotten Change-Id: I88aaacbd9f8562c8a0b800013bb596c166fae6d7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update canvas example to use QtQuickControls2Oliver Eftevaag2021-03-1011-54/+159
| | | | | | | | | | | | | The QtQuick examples should ideally have a more native look and feel. Making them use controls from QtQuickControl will cause them to adapt to the desktop style. This patch replaces the previous Sliders from the 'shared' directory, with Sliders from QtQuickControls2 Task-number: QTBUG-90880 Change-Id: I90521abf7059950521bc3d1a54994d2cca07259d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Update window example to use QtQuickControls2Oliver Eftevaag2021-02-234-48/+48
| | | | | | | | | Replaces the use of custom made components from the shared directory, with QtQuickControls2 components. Fixes: QTBUG-90883 Change-Id: I6e659188aa75bfacf8181689f30580783bf280a2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make localstorage example independent of the 'shared' directoryOliver Eftevaag2021-02-222-73/+1
| | | | | | | | | | Removed dependency to the components in the 'shared' directory from the project files. The CMakeLists.txt is generated from the qmake project file using the pro2cmake.py utility. Task-number: QTBUG-90884 Change-Id: I4f52a065d02bdfc747a2bca89ad0c1707a7ef9ec Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix custommaterial example with OpenGLLaszlo Agocs2021-02-193-1/+1
| | | | | | | | | | | | | The member names in the "uniform block" (which is in practice mapped to a struct uniform with GLSL) must match between the vertex and fragment shaders, even if the member is not used in one of the shaders. This is because OpenGL/GLSL's interface matching rules, which would cause the shader program fail to link due to a mismatch in the structs in the two shaders. Pick-to: 6.1 6.0 Change-Id: I9a928b4b20fdff14530c16a93a52967ce6c328a3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Improve visuals and usabilityOliver Eftevaag2021-02-163-45/+129
| | | | | | | | | | | | Usability has been improved when entering new rows into the database. The user is now only able to write in the input form when editing an exiting entry or creating a new entry. The warning message associated with entering invalid input will now disappear after a few seconds. The ListView delegate is now slightly larger, and looks slightly better. Task-number: QTBUG-90884 Change-Id: Idf7ca9c0bb8b86ac06fed80e945800603f7b03d9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Update localstore example to use QtQuickControls2Oliver Eftevaag2021-02-168-135/+35
| | | | | | | | Removing MyButton.qml and replacing it with QtQuickControls2. Task-number: QTBUG-90884 Change-Id: Ie1b22e817dedfd71593b074561bdfe2e7dc36008 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Use functions as signal handlers when accessing parametersUlf Hermann2021-02-1210-14/+15
| | | | | | | | | Injected signal handlers are bad practice because they aren't declared. Pick-to: 6.1 Task-number: QTBUG-89943 Change-Id: I3a691f68342a199bd63034637aa7ed438e3a037b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix dead link Qt logo in exampleNico Vertriest2020-12-161-2/+3
| | | | | | Task-number: QTBUG-80412 Change-Id: Ib97033ec3729a4af2e7404a8ddbb860e574c928d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Regenerate projects using pro2cmake one last timeAlexandru Croitor2020-12-101-0/+144
| | | | | | | | | And fix up some incorrect qmake project files Pick-to: 6.0 Change-Id: Ia6d27ac68195635021fe7c4a5f06386a60f3f323 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QML engine: Deprecate DefaultMethodFabian Kosmale2020-12-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | Assigning objects to signal handlers can be convenient, as seen in the examples which use it together with ListView.onRemove. However, that convenience makes it hard to reason about what actually happens. Moreover, the only user of that functionality are the Animation classes, and the usage of DefaultMethod is not documented anywhere. [ChangeLog][QtQml] Assigning an object to a signal handler is deprecated. Instead, create the object, give it an id, and call the desired slot from the signal handler. For instance, instead of of ListView.onRemove: SequentialAnimation {...} use SequentialAnimation {id: removeAnimation; ...} ListView.onRemove: removeAnimation.start() A warning will be printed whenever an assignment of an object to a signal handler occurs. The warning can be controlled via the qt.qml.defaultmethod logging category. Change-Id: I001ddf4d7933871977f84a5e012d020fb043cc64 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix building the d3d11underqml example with MinGWFriedemann Kleint2020-11-261-9/+9
| | | | | | | | | | | Fix format mismatch qtdeclarative/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp:369:16: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'HRESULT' {aka 'long int'} [-Werror=format=] qFatal("Failed to create buffer: 0x%x", hr); by casting to uint (as is done in an existing qWarning()). Pick-to: 6.0 Change-Id: I9bed3066936af8a1831b695a76d40989a834fde9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* qmlfunctions.qdoc: Add clarification to QML_FOREIGNMaximilian Goldstein2020-11-231-0/+4
| | | | | | | Fixes: QTBUG-87150 Pick-to: 5.15 6.0 Change-Id: If99a06a07892bdfef7b6b1e8fa737480750992fe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make text example work in static CMake buildsFabian Kosmale2020-11-111-0/+2
| | | | | | | | Task-number: QTBUG-87702 Task-number: QTBUG-86947 Change-Id: I9dd1b6ca633be60977109acf6b00123d4492b726 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QQmlListProperty: Use qsizetype rather than int for sizesUlf Hermann2020-11-092-12/+12
| | | | | | | | | | [ChangeLog][QtQml] The QQmlListProperty callback functions use qsizetype now as type for the size of a list. This is in line with the containers that you might use to back the list. Fixes: QTBUG-88269 Change-Id: Ia38403cb32f241e6c70e1a580dbeff1d6d694331 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2020-11-052-4/+2
| | | | | | | | | | | - Remove links to modules and examples that are not part of Qt 6. - Remove links to entities marked as \internal - Add missing enum value and QML property docs where it's trivial to do so. Task-number: QTBUG-88156 Change-Id: I10a1c7bcc5fe0e2354ea69eaf24930362edb7415 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix CustomAffector exampleKaj Grönholm2020-11-051-23/+2
| | | | | | | | | Don't use particle.r which doesn't exist since the CustomParticle removal. Make example a bit simpler without this. Task-number: QTBUG-88173 Change-Id: Id994a9a58796e8194fdccd63c6439d4c19681a45 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add #include <QPainter> in textballoon exampleShawn Rutledge2020-10-311-0/+1
| | | | | | | | | It is not building in namespaced builds without this. Others also needed this include, such as qml/tutorials/extending-qml/chapter2-methods/piechart.cpp Change-Id: Ifbb0557655d247b146ca2eddb07ea6813d9ffacb Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* CMake: Regenerate examples to set the WIN32_EXECUTABLE propertyAlexandru Croitor2020-10-2679-0/+340
| | | | | | | | | As well as the MACOSX_BUNDLE properties as necessary. Task-number: QTBUG-87664 Task-number: QTBUG-86827 Change-Id: I46769fb543acb2cbeba122470b5e44ad478fbe4e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix up shadereffect example docsLaszlo Agocs2020-10-232-7/+8
| | | | | | | | The screenshot has been out of date for years now. Update it as well. Change-Id: I2b9ae3b0c24b0de7f0cd8a2284d67023237f0944 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* CMake: Regenerate examples to use qt_add_executableAlexandru Croitor2020-10-2074-74/+74
| | | | | | Task-number: QTBUG-87661 Change-Id: Ie5bba408000211b24694aa0143bdf79c4a298f42 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* Adapt to platform API renameTor Arne Vestbø2020-10-092-3/+3
| | | | | Change-Id: I1f2171e18ec3df71f7eaec1be0e0e0d1442a3860 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix lineedit exampleUlf Hermann2020-10-051-1/+1
| | | | | | | | | | The default name created by QML_ELEMENT is the name of the local type, not the one of the foreign type. Pick-to: 5.15 Task-number: QTBUG-87150 Change-Id: I2b5dfcea3e835d4e69d5fa4df179333a37ee1d6e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix additional warnings from usage of deprecated APIsVolker Hilsheimer2020-09-162-5/+5
| | | | | | | | | | Replace more QLibaryInfo::location with QLibraryInfo::path Replace old event accessors APIs, including relevant comments. Change-Id: Ie205fc93b6e1c0dfb3dca9100fbde417ab68fc9f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix additional warnings from usage of deprecated APIsVolker Hilsheimer2020-09-161-1/+0
| | | | | | | | Replace QLibaryInfo::location with QLibraryInfo::path, and remove usage of Qt::AA_EnableHighDpiScaling, which doesn't have any effect anymore. Change-Id: I347e8a83e0f4c2b4405f2512e569ad3234f05a98 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* shadereffect example: remove unused legacy shader codeLaszlo Agocs2020-09-1328-239/+137
| | | | | | | | No point in exercising the file selector magic when there is only one possible path in Qt 6. Change-Id: I3b49b19d57a89855063e983ab0add13335840fb9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* examples: include QQuickWindow in squircle headersUlf Hermann2020-09-134-0/+4
| | | | | | | This is required because QQuickWindow is passed as a signal parameter. Change-Id: Ied10beded7253558d080af4806d1b95880bf2d98 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make twotextureproviders example functional againLaszlo Agocs2020-09-074-0/+42
| | | | | Change-Id: I6a317fc8628b902e535a31daf4a3886fc87d08bc Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Regenerate graph example shadersLaszlo Agocs2020-09-074-0/+0
| | | | | Change-Id: Id4fe4d0e177180fadd10f34b9ebad17c71e40314 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add CMake project file for custommaterial exampleLaszlo Agocs2020-09-074-6/+126
| | | | | | | | | The name conflicts with a Quick3D example so try to use the same approach as it was done for customgeometry. Task-number: QTBUG-86205 Change-Id: Ie01cd6c0118d512b2f45d4c6e782ec6639e052c6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove old GLSL code from fboitem exampleLaszlo Agocs2020-09-077-34/+18
| | | | | | | There is no OpenGL path anymore in Qt 6, no point using file selectors. Change-Id: I4b7afbbb193dfe1a6e912a909babab0aeb8dcdda Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove use of deprecated High-DPI application attributesTor Arne Vestbø2020-09-024-4/+0
| | | | | Change-Id: Ibfb50fdcbb51ba93d6e5d11f9e8ce0e7b3bfde79 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Example: Pass QDate, QTime by value, not by const referenceEdward Welbourne2020-09-018-11/+11
| | | | | | | They're value types, packaging qint64 and int, repsectively. Change-Id: Icf18794466cd140e1384d6dd0de736fbb2c05a48 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Capitalize "GUI" correctlySze Howe Koh2020-08-301-1/+1
| | | | | | Pick-to: 5.15 Change-Id: I2230e2dcb7bc2497b5dbe71a22c21d84176b5e57 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Doc: Fix minor typosSze Howe Koh2020-08-301-1/+1
| | | | | | Pick-to: 5.15 Change-Id: I4c51c40697e410d56b6a2d2446ed9f8ae218576d Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* CMake: Rename example conflicting with qtquick3dAlexandru Croitor2020-08-252-7/+63
| | | | | | Fixes: QTBUG-86205 Change-Id: I38992501abb86a4328527283ad8924ec886ea8c8 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Switch to MTLTexture protocol in QSGTexture native accessLaszlo Agocs2020-08-041-1/+1
| | | | | | | Now only available from ObjC code. Change-Id: I88df6c8839fc660ffd2b8e88a789ca73a9d4accd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add type safe native texture accessorsLaszlo Agocs2020-08-032-8/+6
| | | | | | | | Following the pattern from QtGui. Task-number: QTBUG-85239 Change-Id: I07b4456028d0f45223ad10e55ce65f423bab6a9b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace Qt's MidButton with MiddleButtonEdward Welbourne2020-07-221-1/+1
| | | | | | | | | | The latter has been the preferred name since Qt 4.7.0. Added a comment on where the old name is exposed to QML that it's only for backwards compatibility. Pick-to: 5.15 Change-Id: I2c5088d597dd7327cc5899d06afb180d0ec2893e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* shadereffect example: change to relative file refsLaszlo Agocs2020-06-301-7/+7
| | | | | | | | Like with Image, this should work with ShaderEffect as well, and is the better default approach to promote to users. Change-Id: I9b8427297687db189045886fbaf17d2b4a517aba Reviewed-by: Andy Nichols <andy.nichols@qt.io>