diff options
author | Bea Lam <bea.lam@nokia.com> | 2009-11-25 05:05:55 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2009-11-25 05:05:55 (GMT) |
commit | 20504e30096f2942abcadb966b26c834a6062ea5 (patch) | |
tree | 3d31696bed1bfc1ba17fc441babdf0b6c6ad9410 /src/declarative/qml/qmlscript.cpp | |
parent | 553cf812d36437542005fcf758fe707b7e1c63a5 (diff) | |
download | Qt-20504e30096f2942abcadb966b26c834a6062ea5.zip Qt-20504e30096f2942abcadb966b26c834a6062ea5.tar.gz Qt-20504e30096f2942abcadb966b26c834a6062ea5.tar.bz2 |
Doc improvments
Diffstat (limited to 'src/declarative/qml/qmlscript.cpp')
-rw-r--r-- | src/declarative/qml/qmlscript.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/declarative/qml/qmlscript.cpp b/src/declarative/qml/qmlscript.cpp index 7242498..eb0b858 100644 --- a/src/declarative/qml/qmlscript.cpp +++ b/src/declarative/qml/qmlscript.cpp @@ -43,12 +43,13 @@ /*! \qmlclass Script QmlScript - \brief The Script element adds JavaScript snippets. + \brief The Script element provides a way to add JavaScript code snippets in QML. \ingroup group_utility - QmlScript is used to add convenient JavaScript "glue" methods to - your Qt Declarative application or component. While you can have any JavaScript code - within a QmlScript, it is best to limit yourself to defining functions. + The Script element is used to add convenient JavaScript "glue" methods to + your Qt Declarative application or component. + + An example: \qml Script { @@ -60,23 +61,27 @@ MouseRegion { onClicked: debugMyComponent() } \endqml - \note QmlScript executes JavaScript as soon as it is specified. - When defining a component, this may be before the execution context is - fully specified. As a result some properties or items may not be - accessible. By limiting your JavaScript to defining functions that are - only executed later once the context is fully defined, this problem is - avoided. + \note While it is possible to use any JavaScript code within a Script element, + it is recommended that the code be limited to defining functions. The Script + element executes JavaScript as soon as it is specified, so + when defining a component, this may be done before the execution context is + fully specified. As a result, some properties or items may not be + accessible. You can avoid this problem by limiting your JavaScript to + defining functions that are only executed later once the context is fully + defined. + + \sa {ECMAScript Blocks} */ /*! \qmlproperty string Script::script \default - JavaScript code to execute. + The JavaScript code to be executed. */ /*! \qmlproperty url Script::source - Setting this property causes the Script element to read JavaScript code from - the file specified. + Specifies a source file containing JavaScript code. This can be used instead + of providing inline JavaScript code in the Script element. */ |