aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/src/qtqml-tool-qmlsc.qdoc
blob: b1276449fc949d2df41fd33bbe709c5d45531278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
\page qtqml-tool-qmlsc.html
\title QML Script Compiler
\brief A tool to compile functions and expressions in QML.
\keyword qmlsc

The QML Script Compiler, \c qmlsc will compile functions and expressions in QML
files of an application into C++ code within limitations set by the nature of
JavaScript. It replaces \e qmlcachegen, and simply generates C++ code in addition
to byte code for functions that can be exhaustively analyzed. The following flow
chart explains the compilation of \e qmlsc.

\image qmlsc-compilation-scheme.png

\section1 Limitations when compiling JavaScript

Many JavaScript constructs cannot be efficiently represented in C++. \e qmlsc
skips the C++ code generation for functions that contain such constructs and
only generates byte code to be interpreted. Although, most common QML expressions
are rather simple: value lookups on QObjects, arithmetics, simple if/else or loop
constructs. Those can easily be expressed in C++, and doing so makes your
application run faster.

\e qmlsc is available for commercial customers and some of its features are
merged into \e qmlcachegen, which continues to be available with all versions of
Qt.
*/