blob: 26e1fb60320e3c126401bb46ee4935182f99db60 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page topics-scripting.html
\title Scripting
\brief Qt's scripting features
Qt has three main ways to help make an application scriptable. All of them allow easy
integration of the \l{ECMAScript Reference}{ECMAScript} (more widely known as JavaScript) language into the application. Depending on how deep
the integration should be, one of these APIs can be used:
\section1 Qt Script Module
\l {Qt Script} is a separate module, designed with scripting applications in mind. It has
a mature and rich API that permits a really deep integration of scripting functionality. It allows
evaluating and debugging of scripts, and advanced use of objects and functions. It also gives access to a really
low level \l{ECMAScript Reference}{ECMAScript} engine API. Full documentation about using \l{Qt Script} to make an application
scriptable can be found \l{Making Applications Scriptable}{here}.
\section1 JS API
This is a simple API, very similar to \l{Qt Script}, but limited to basic functionality. The main
classes are QJSEngine and QJSValue, which can be used to embed pure \l{ECMAScript Reference}{ECMAScript} functionality
like evaluating scripts and calling functions.
\section1 QML
\l{Qt QML}{QML} exposes a modified \l{ECMAScript Reference}{ECMAScript} environment. It is designed to mix well with the JavaScript
API mentioned earlier. QML may be used without \l{Qt Quick} components, which may be useful for
server side scripting. With QML it is possible to mix pure \l{ECMAScript Reference}{ECMAScript} and declarative components
(\l{Use Case - Integrating JavaScript in QML}).
All of these three scripting solutions seamlessly inter-operate with \l{The Meta-Object System}{the Meta-Object System}, which means that all \l{Signals & Slots}{signals and slots} and
\l{The Property System}{properties} of a QObject instance are accessible in an \l{ECMAScript Reference}{ECMAScript} environment.
*/
|