aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/snippets
Commit message (Collapse)AuthorAgeFilesLines
...
* Document qmltc toolAndrei Golubev2022-01-197-0/+643
| | | | | | | | | | | | | | Add initial qmltc tool documentation with introduction, compilation process picture, description and limitations To simplify the description, we can consider some simple application. The same app can additionally become a test scenario for qmltc and a showcase of its capabilities Task-number: QTBUG-84368 Pick-to: 6.3 Change-Id: If6d586a8c68f48d17133b25170d0fff627e2066c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2022-01-061-1/+1
| | | | | | | | | | Using REQUIRED as a prefix instead of suffix works better with OPTIONAL_COMPONENTS, and is also the order in the CMake manual. Task-number: QTBUG-98867 Pick-to: 6.2 6.3 Change-Id: I021c8f0c7f886d8f7037a1dd92ef1e8d747a45f4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* doc: Add a section about singleton types in qt_add_qml_moduleAlexandru Croitor2021-12-032-0/+60
| | | | | | | | | | | | | | QT_QML_SINGLETON_TYPE was only documented on the qt_target_qml_sources page. Add a short section about singletons to the qt_add_qml_module page and reference the other page. Adjust the example in qt_target_qml_sources to show case how to set the singleton source property. Pick-to: 6.2 Fixes: QTBUG-97541 Change-Id: I11aa3cb7c0feb748eba1d7ac9ef81a8ac6cb16b1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Doc: Fix core QML functions signatures and examplesIvan Tkachenko2021-11-021-3/+12
| | | | | | Pick-to: 6.2 Change-Id: I539e54a9a44b65ea9ff50a78c3cfa711860874d4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Update PropertyChanges in src and toolsUlf Hermann2021-10-291-2/+1
| | | | | | | | | | Use generalized grouped properties rather than the target/property syntax. Change-Id: I2cf42fa7933d67aa40ded5ffd00be51be8f9b7c2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace 0 pointer constants with nullptrAllan Sandfeld Jensen2021-10-182-2/+2
| | | | | | | Replaced in most common patterns. Change-Id: Idcaff1f2e915f29922702d3600a2e5f1e2418a7a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix documentation on JavaScript importsUlf Hermann2021-09-271-1/+2
| | | | | | | | | | Actually export the functions we use, clarify that import and .import are different, and discourage .import. Pick-to: 6.2 5.15 Fixes: QTBUG-96902 Change-Id: I2471d876c83da3d2110add6005d54311d9261566 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Add documentation for qt_target_qml_sources()Craig Scott2021-08-305-0/+49
| | | | | | Pick-to: 6.2 Change-Id: I4e868bb522202f23e99abbb808b976c1d58ebf8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: Improve QQmlParserStatus code snippetIvan Tkachenko2021-08-181-2/+5
| | | | | | | | | Make it potentially compile-able by adding required headers (though it's not like it's really being compiled anyway), and add `override` keyword for methods which are actually re-declared from pure virtual base. Change-Id: I7b0c13de6a63aacdb082517ca586fb9db8c1087a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Adjust import documentation to mention that versions are optionalFabian Kosmale2021-07-211-2/+2
| | | | | | | | | | This change also removes the versions from the import statements. Task-number: QTBUG-95302 Pick-to: 6.1 6.2 Change-Id: Ie29e57a618917977b46dff25d13e3ca3eff249b5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use functions as signal handlers when accessing parametersUlf Hermann2021-02-121-3/+3
| | | | | | | | | 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>
* Remove the qmake project filesFabian Kosmale2021-01-153-42/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Fix occurrences of \Q_OBJECT in code snippetsTopi Reinio2020-12-083-0/+248
| | | | | | | | | | | | | | 'Q_OBJECT', even in a comment, interferes with automoc. Prefixing it with a backslash solves the automoc issue, but documentation looks wrong as content inside \code is taken verbatim. Move code snippets to doc/snippets and refer to them with \snippet commands. Pick-to: 6.0 Change-Id: Ied7fdf87ef5edd2b237498b91b162c19bf7bc636 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Use explicit linkage with target_link_librariesKai Koehne2020-12-021-1/+1
| | | | | | | | | | | | | | | The Professional CMake book suggests always using explicit linkage with target_link_libraries, so let's use that. Whether to use PUBLIC or PRIVATE depends on the context. But let's be conservative and advise on using PRIVATE by default. Also prefer the versioned target name over the unversioned one. Task-number: QTBUG-88935 Change-Id: I29a6b07803d7aab10eb93a5348d12b9d1620d132 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io>
* Doc: use editingFinished signal of TextInput instead of textChangedMitch Curtis2020-10-061-1/+1
| | | | | | | | | | The former is only emitted as a result of user interaction, whereas the latter is also emitted as a result of programmatic changes. It's better to use editingFinished(). Pick-to: 5.15 5.12 Change-Id: I71bb084bced6c33d940f550b5e3b2e57df45bd3c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove qml statemachine plugin from qtdeclarativeKarsten Heimrich2020-08-2313-1274/+0
| | | | | | Task-number: QTBUG-80316 Change-Id: I584b699a1eec88117f343870bd2cd01075da64f7 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Document how to use CMake for Qt QmlKai Koehne2020-06-232-53/+4
| | | | | | Task-number: QTBUG-73058 Change-Id: Ic27cfdf76b8f77c9834baaeaf449434bf5f28416 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Fix file name comment in script.mjs snippetUlf Hermann2020-04-271-1/+1
| | | | | | | | Task-number: QTBUG-83504 Pick-to: 5.15 Change-Id: I4970e929b80f5dae4245404a6db3353f304542ec Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Doc: Fix documentation warnings for Qt QMLTopi Reinio2020-02-201-1/+1
| | | | | | Fixes: QTBUG-82313 Change-Id: I7c2f30411ab8011254d7c232c87cb12a39761bda Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Modernize backend example and adapt C++ integration docsUlf Hermann2020-02-123-4/+19
| | | | | | | | We want people to use the static type registration. Change-Id: I98e51af9df1a2f73df10f82458a7b7f5c5e5aad1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Modernize scarceresources snippets and adapt docsUlf Hermann2020-02-113-63/+106
| | | | | | | Also, make sure we can actually compile and test-run the snippets. Change-Id: I50d2bd85528ddbd8d6ad3f38e716b600df54a571 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add inline component documentationFabian Kosmale2020-02-064-0/+267
| | | | | | | Change-Id: Ieff73eba115802722afdbb491b74df5eaad9a4f4 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Pierre-Yves Siret <gr3cko@gmail.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Fix documentation warningsTopi Reinio2019-11-112-78/+0
| | | | | | | | | | | | | | | | | | There were a lot of documentation warnings introduced by the separation of QtQml.Models and QtQml.WorkerScript modules from the QtQml documentation project into their own sub-projects. Fix the above, and also ensure that the experimental Qt.labs.qmlmodels QML types are listed in the documentation, and add them also on the QML module page for QtQml.Models. A few warnings remain, they may be indicative of issues not in the scope of this commit. Fixes: QTBUG-79812 Change-Id: Idc25c976e4c96feab4aae893519d6c9245f57a64 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Re-add documentation for Qt Qml ModelsUlf Hermann2019-09-1714-1352/+0
| | | | | | | It got lost when moving the classes. Change-Id: I7b3a9fec8fe9439c548da570e430d3b82613b816 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix docs to explain the new type syntax for QML methodsSimon Hausmann2019-07-105-12/+12
| | | | | | | | | | | | | | [ChangeLog][QtQml] It is now possible to specify types for method parameters and their return value in QML (basic and object types), using TypeScript-like syntax with a colon separator. The syntax for QML declared signals supports the same style. This change also adapts the remaining snippets and docs to the "fresher" qml signal parameter syntax. Change-Id: I601781f01f696276951b04785584adab39fedfd9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-111-2/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4value_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmltypewrapper.cpp src/quick/items/qquicktableview.cpp Change-Id: I684f8e01a711580512848bf1253f39b39fcbf4c7
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-061-2/+2
| |\ | | | | | | | | | Change-Id: I59cb196ab17ed8504b33db01d827052eb6891efa
| | * Doc: Remove superfluous double quotes in code snippetsPaul Wicking2019-06-041-2/+2
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-75957 Change-Id: I2c9c70461a828978d1413b8cbdb407663b4b7493 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Add TableModelColumnMitch Curtis2019-04-084-136/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to support simple object rows by default, which we expect to be the most common use case for TableModel. Complex rows are supported, but with a limited subset of functionality. Things that could be improved: - Would be nice if we could get arbitrary/dynamic properties like ListModel has, without the complex code that comes with it. That way we could get rid of all of the role properties and users could have their own custom roles. The limitation of only having built-in roles becomes too restrictive very quickly. Change-Id: Icbdb6b39665851c55c69c0b79e0aa523c5d46dfe Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-083-4/+4
|\| | | | | | | | | | | Change-Id: I7aa5284298990062fac9d9f1ab55d05f9b225ac9
| * | Doc: Promote use of ECMAScript modules over Qt.include()Ulf Hermann2019-03-043-4/+4
| |/ | | | | | | | | | | | | | | | | | | | | Also, mention that Qt.include() is deprecated. [ChangeLog][QtQml] Qt.include() is deprecated in favor of ECMAScript modules. Task-number: QTBUG-74068 Change-Id: Ia13e4f1577d86b869a9a1cd810a82ff0b27ea0cc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | TableModel: support built-in QML model rolesMitch Curtis2019-02-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | For the display role, we'll return the first role in that column if it wasn't explicitly specified. For every other role, we can just return an invalid QVariant. As usual, roleDataProvider can be used for any data that is missing. Before this patch, the extra roles were missing from roleNames, so they couldn't be used in delegates. Change-Id: I53ac5b75526bcddec44baf834f6a093115a70993 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | TableModel.roleDataProvider: replace row, column with index argumentShawn Rutledge2019-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | QModelIndex has various advantages over separate int row and column in TableModel API; we intend to expose it via an invokable index() method and via a context property for delegates, and use it in the invokable data() function. So we should be consistent by using it in roleDataProvider too. This way the callback only requires 3 arguments instead of 4, and the first one is potentially extensible, just in case. Change-Id: I7b1bc9ea5adb64941979d83901b3566278357e98 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | TableModel: add roleDataProvider callbackShawn Rutledge2019-02-151-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As an alternative to trying to write smarter C++ in the data() accessor, we give the user full control of data conversion by calling an external JS function if defined, to map role to the value that data() should return. This enables extracting arbitrary values, converting the data in arbitrary ways, or even doing calculations in case the EditRole stores a formula and the DisplayRole should provide the result, or something like that. This callback is implemented somewhat like TableView.columnWidthProvider, but the arguments are more complex: function(row, column, role, rawData) Change-Id: Ifaf5807f4809e0b5ad1d1c403f65c0707b902f10 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Add TableModelMitch Curtis2019-02-082-0/+239
|/ | | | | | | | | | | | | | | | | | | | | This is a QML type that can be used as a model for the new TableView. The model data is set by assigning a JavaScript array to the rows property (or by calling appendRow()). After data has been assigned for the first time, the available columns and roles are fixed for the lifetime of the model, as opposed to ListModel where the dynamicRoles property could be used. This is done intentionally to simplify the code. The API is designed to be familiar to users of ListModel: - To add new rows, use appendRow() and insertRow(). - To modify existing rows, use setRow(), moveRow(), removeRow(), and clear(). [ChangeLog][Qt Labs QML Models] Added the TableModel QML type, a JavaScript-based model for the new TableView. Fixes: QTBUG-70334 Change-Id: I55387a08b122227c5624f78af3d450b7695d974a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Use input handlers and controls wherever appropriateVenugopal Shivashankar2018-11-011-5/+4
| | | | | | | | In addition, changed the \section titles to sentence case. Change-Id: If62cc8f2a3f6a99123ccfb4d030d3f58a2fe8dea Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Remove documentation for deprecated QML typesVenugopal Shivashankar2018-09-254-0/+0
| | | | | | | | | | | | | VisualDataModel, VisualDataGroup, and VisualItemModel are replaced with DelegateModel, DelegateModelGroup, and ObjectModel respectively (since 7cad0e52c5a020bd29635e9912fd8946a6b48124). Also renamed/deleted a few snippet files and an image. Task-number: QTBUG-37725 Change-Id: I5fa93993a31d8f9b08e7a282d5550ddd9bfb813f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add support for ECMASCript modules in WorkerScript elementsSimon Hausmann2018-08-212-1/+1
| | | | | | | | | Similar to script imports from .qml files, the .mjs extension is used to distinguish between ES modules and plain script files. Change-Id: Id5f9b59fb77e99e3c9d6a404e6d091d96b501ad6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Move literal codeblocks to snippet filesVenugopal Shivashankar2018-06-222-0/+56
| | | | | Change-Id: Iff45ea6cf414717fd1cb0a194eef390a9f153838 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.105.10Liang Qi2018-02-071-0/+20
|\ | | | | | | Change-Id: I3b250545e334f50dcef1a75acdef51820d34079a
| * Document that Q_GADGET classes cannot be used with newQMetaObject()Mitch Curtis2018-02-051-0/+20
| | | | | | | | | | | | Task-number: QTBUG-62007 Change-Id: I63d5a57163b36bc8629930e1cda8d5afa1e77d15 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-24106-333/+1370
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlimport.cpp src/qml/qml/qqmlimport_p.h src/qml/qml/qqmltypenamecache.cpp Done-with: Ulf Hermann<ulf.hermann@qt.io> Change-Id: I41ba7a592b2659ddf53da6952ea3b456a7bba319
| * Fix qdoc files to always use FDLKai Koehne2017-10-181-31/+18
| | | | | | | | | | Change-Id: If20d71aa85360ad94a2ef12a25ab37cd2d90abf9 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
| * Fix outdated BSD license headerKai Koehne2017-10-17105-302/+1352
| | | | | | | | | | Change-Id: Icc08925454445fc9497fb3bfd2c26efe90605983 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* | Doc: fix QJSEngine code snippetSamuel Gaist2017-09-301-1/+1
|/ | | | | | | | The code snippet showing how to use QJSValue::call was wrong. This patch corrects that. Change-Id: Ib4c6479f3ef63f4f95af845d0af228d3c71f0731 Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* QJSEngine: document limitation of dynamic QObject propertiesMitch Curtis2017-07-271-0/+13
| | | | | | | | | Dynamic QObject properties can not be accessed through C++ (via QJSValue) nor JavaScript. Task-number: QTBUG-38181 Change-Id: I78bb9898fef615a647234ae8df444e8855870258 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Doc: Avoid copyright text in the codeblock by using \snippetVenugopal Shivashankar2017-06-164-5/+8
| | | | | | Change-Id: Ib6f1a1e796a085d0f274c7e87d4ed1314e958a06 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Simplify documentation about integrating QML and C++Venugopal Shivashankar2017-06-084-0/+290
| | | | | Change-Id: If110d02aad991646054ee6e522549c07f00946e1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add Qt.callLater() function.Michael Brasser2016-03-081-0/+109
| | | | | | | | | | | | | Calling the new Qt.callLater() multiple times in quick succession with the same JS function as argument will result in a single call to that function, thus eliminating redundant unnecessary calls. Based on previous patches by Mathias Malmqvist <mathias.malmqvist@nokia.com> and Chris Adams <chris.adams@jollamobile.com> Change-Id: Ie71b60d4d48fa73d3deae723775cf36662d199ae Task-number: QTBUG-22400 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make obj2's text consistent between qtBinding.[23].qmlEdward Welbourne2015-10-161-1/+1
| | | | | | | | The expected text output sides with .3.qml, so fix .2.qml Task-number: QTBUG-48652 Change-Id: I91ac0ab0854df95e06225938d195cd5e3be5abc3 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>