aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/doc/qtqmlcompiler-index.qdoc
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-08-29 15:57:14 +0200
committerOlivier De Cannière <olivier.decanniere@qt.io>2023-11-26 09:57:56 +0100
commitb061f897d026acf403cd907fef1a486ba7179161 (patch)
tree697e61a26b8f313e8bc2d75462c6afa2586a4d34 /src/qmlcompiler/doc/qtqmlcompiler-index.qdoc
parent5e9b261aa8b0f55c82a1b55c9d12b29d164196a4 (diff)
QmlCompiler: restructure doc
- align structure with other index pages - reference the actul compilers - link to tutorial Pick-to: 6.6 Change-Id: Ibc98c846f83638595f5752f3a0d342bcf1e1aa10 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/doc/qtqmlcompiler-index.qdoc')
-rw-r--r--src/qmlcompiler/doc/qtqmlcompiler-index.qdoc44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/qmlcompiler/doc/qtqmlcompiler-index.qdoc b/src/qmlcompiler/doc/qtqmlcompiler-index.qdoc
index d9d9a4e2a9..03a2eafbbd 100644
--- a/src/qmlcompiler/doc/qtqmlcompiler-index.qdoc
+++ b/src/qmlcompiler/doc/qtqmlcompiler-index.qdoc
@@ -6,15 +6,32 @@
\title Qt QML Compiler
\brief Provides tools for static analysis of QML code.
+ The Qt QML Compiler module contains shared functionality needed by QML
+ tooling like the \l{Qt Quick Compiler} and \l{qmllint}.
+ It also provides the QQmlSA framework, which can be used to extend the
+ built-in analysis capabilities of the tools.
+
+ \section1 Using the Module
+
+ \include {module-use.qdocinc} {using the c++ api}
+
+ \section2 Building with CMake
+
+ \include {module-use.qdocinc} {building with cmake} {QmlCompiler}
+
+ \section2 Building with qmake
+
+ \include {module-use.qdocinc} {building_with_qmake} {QmlCompiler}
+
+ \section1 Using the QQmlSA framework
+
The Qt QML Compiler module offers the QQmlSA framework which provides tools
for static analysis of QML code. These tools can help ensure syntactic
validity and warn about QML anti-patterns.
-
Adding static analysis to a QML program is done by writing plugins. They
will run a collection of analysis passes over the elements and properties
of the QML code. The passes can be registered with a PassManager which
holds the passes and can be called to analyze an element and its children.
-
A pass is a check for a certain rule or condition evaluated on elements or
properties. If the condition is met, the pass can warn the user of an
indentified issue in the code and maybe even suggest a fix. It is called a
@@ -22,18 +39,15 @@
running a collection of passes on them in succesion. Each pass should be
responsible for identifying one specific issue only. Combining a set of
passes can perform more complex analysis and, together, form a plugin.
-
Element passes are defined by two main components, namely \c shouldRun()
and \c run(). When performing the analysis, the pass manager will execute
the pass over every element it encounters while traversing the children of
the root element. For each element, if \c shouldRun() evaluated on that
element returns \c true then \c run() is executed on it.
-
Passes on properties trigger on three different events, namely when the
property is bound, when it is read, and when it is written to. These can be
implemented by overriding the \c onBinding(), \c onRead() and \c onWrite()
functions respectively.
-
As the code grows, so does the number of elements and properties.
Performing the static analysis passes on all of them can become expensive.
That's why it is good to be granular when deciding which elements and
@@ -44,4 +58,24 @@
\c moduleName, \c typeName and \c propertyName strings as arguments. These
are used to filter down the set of properties affected by the registered
pass.
+
+
+ \section1 Examples
+
+ The \l{QML Static Analysis Tutorial} shows how to use the \c{QQmlSA}
+ framework to create a custom \l{qmllint} pass.
+
+ \section1 Reference
+
+ \list
+ \li \l {Qt QML Compiler C++ Classes}
+ - the C++ API provided by the QmlCompiler module
+ \li QML tooling using the static analysis capabilities
+ \list
+ \li \l{QML script compiler}
+ \li \l{qmllint}
+ \li \l{QML Language Server}
+ \li \l{QML type compiler}
+ \endlist
+ \endlist
*/