diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-10-31 15:12:23 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-11-04 01:29:43 +0100 |
commit | 85885624446558c2bf9fa27cb5bded9433943312 (patch) | |
tree | 8fb66969b83436880449a42b64f02a1b8564e333 /src/qml/doc | |
parent | d0484963f4b8839c3e43ad0d72e2bc6c4fbfb512 (diff) |
Doc: Warn about slowness of createQmlObject()
Pick-to: 6.6 6.5
Change-Id: Ie00d0df9bc8ad6106559ce0a66c91e0aaac81cfd
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/doc')
-rw-r--r-- | src/qml/doc/src/javascript/dynamicobjectcreation.qdoc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc index 29a4a67460..4342d3bada 100644 --- a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc +++ b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc @@ -102,6 +102,12 @@ It is also possible to instantiate components without blocking via the \section2 Creating an Object from a String of QML +\warning Creating objects from a string of QML is extremely slow since the engine has to compile the +passed QML string every time you do it. Furthermore, it's very easy to produce invalid QML when +programmatically constructing QML code. It's much better to keep your QML components as separate +files and add properties and methods to customize their behavior than to produce new components by +string manipulation. + If the QML is not defined until runtime, you can create a QML object from a string of QML using the \l{QtQml::Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example: |