diff options
author | Chris Adams <christopher.adams@nokia.com> | 2012-05-28 17:12:56 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-21 09:58:56 +0200 |
commit | 5e33b0f580d2b20f1a2989bf2ee8dde4525a2e39 (patch) | |
tree | 780d25ce7d8955e56ea985a35dd84609df12fbf0 /src/qml/doc/src/javascript/qtjavascript.qdoc | |
parent | 03342a435a88656d64d1445991a4421d244fcb45 (diff) |
Create new documentation structure
The documentation currently has no clear separation between Qt QML
and Qt Quick. With recent commits like:
6c8378eaf1edbbefe6aaa3672b0127816a004fd7
and
ab1e510121c8a679fdaca12ccd30e0f7ac12a26b
the separation between the language definition and implementation,
provided by Qt QML, and the standard library for the QML language,
provided by Qt Quick, is clear.
This commit creates a new documentation structure that is more
navigable and separates concepts into logical categories, with
clear separation between QtQML and QtQuick. It also provides a more
generic QML Application Developer Resources page which contains links
to information for QML application developers.
Change-Id: Ia807ccfbfd24ffa0e1c7f0a51ed9d2ed3aa6a733
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/qml/doc/src/javascript/qtjavascript.qdoc')
-rw-r--r-- | src/qml/doc/src/javascript/qtjavascript.qdoc | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/qml/doc/src/javascript/qtjavascript.qdoc b/src/qml/doc/src/javascript/qtjavascript.qdoc new file mode 100644 index 0000000000..2521e8d91f --- /dev/null +++ b/src/qml/doc/src/javascript/qtjavascript.qdoc @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group qtjavascript + \title Scripting Classes and Overviews + + \brief Classes for embedding JavaScript in Qt/C++ applications. +*/ + +/*! + \page qtjavascript.html + \title Making Applications Scriptable + \ingroup frameworks-technologies + \brief incorporating JavaScript in Qt applications. + + Qt provides support for application scripting with JavaScript. + The following guides and references cover aspects of programming with + JavaScript and Qt. + + \tableofcontents + + \section1 Scripting Classes + + The following classes add scripting capabilities to Qt applications. + + \annotatedlist qtjavascript + + \section1 Basic Usage + + To evaluate script code, you create a QJSEngine and call its + evaluate() function, passing the script code (text) to evaluate + as argument. + + \snippet qtjavascript/evaluation/main.cpp 0 + + The return value will be the result of the evaluation (represented + as a QJSValue object); this can be converted to standard C++ + and Qt types. + + Custom properties can be made available to scripts by registering + them with the script engine. This is most easily done by setting + properties of the script engine's \e{Global Object}: + + \snippet qtjavascript/registeringvalues/main.cpp 0 + + This places the properties in the script environment, thus making them + available to script code. + + \section1 Making a QObject Available to the Script Engine + + Any QObject-based instance can be made available for use with scripts. + + When a QObject is passed to the QJSEngine::newQObject() function, + a Qt Script wrapper object is created that can be used to make the + QObject's signals, slots, properties, and child objects available + to scripts. + + Here's an example of making an instance of a QObject subclass + available to script code under the name \c{"myObject"}: + + \snippet qtjavascript/registeringobjects/main.cpp 0 + + This will create a global variable called \c{myObject} in the + script environment. The variable serves as a proxy to the + underlying C++ object. Note that the name of the script variable + can be anything; i.e., it is not dependent upon QObject::objectName(). + + */ |