diff options
Diffstat (limited to 'src/qml/doc/src/javascript/qmlglobalobject.qdoc')
-rw-r--r-- | src/qml/doc/src/javascript/qmlglobalobject.qdoc | 135 |
1 files changed, 19 insertions, 116 deletions
diff --git a/src/qml/doc/src/javascript/qmlglobalobject.qdoc b/src/qml/doc/src/javascript/qmlglobalobject.qdoc index bba796f9ea..15b9996ff3 100644 --- a/src/qml/doc/src/javascript/qmlglobalobject.qdoc +++ b/src/qml/doc/src/javascript/qmlglobalobject.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtqml-javascript-qmlglobalobject.html \title QML Global Object @@ -31,100 +7,27 @@ The QML JavaScript host environment implements the following host objects and functions. -These are built in and can be used from any JavaScript code loaded in QML, without +They are built-in, so you can use them from any JavaScript code loaded in QML, without additional imports: \list -\li The \l{QmlGlobalQtObject}{Qt object}: This object is specific to QML, and provides helper methods +\li The \l{QmlGlobalQtObject}{Qt object}: A QML object that offers helper methods and properties specific to the QML environment. -\li qsTr(), qsTranslate(), qsTrId(), QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRID_NOOP() functions: - These functions are specific to QML, and provide \l{Overview of the Translation Process}{translation capabilities} to the QML environment. -\li gc() function: This function is specific to QML, and provides a way to manually trigger garbage collection. -\li print() function: This function is specific to QML, and provides a simple way to output information to the console. -\li The \l{Console API}{console object}: This object implements a subset of the \l{http://getfirebug.com/wiki/index.php/Console_API}{FireBug Console API}. -\li \l{XMLHttpRequest}, DOMException: These objects implement a subset of the \l{http://www.w3.org/TR/XMLHttpRequest/}{W3C XMLHttpRequest specification}. -\endlist - -\note The \l {QJSEngine::}{globalObject()} function cannot be used to modify -the global object of a \l QQmlEngine. For more information about this, see +\li \l {Qt::}{qsTr()}, \l {Qt::}{qsTranslate()}, \l {Qt::}{qsTrId()}, \l {Qt::}{qsTrNoOp()}, + \l {Qt::}{qsTranslateNoOp()}, \l {Qt::}{qsTrIdNoOp()} functions: + QML functions that let you translate \l{Mark Strings for Translation} + {strings} and \l{Mark Translatable Data Text Strings}{string literals} in the + QML environment. +\li gc() function: A QML function that manually triggers garbage collection. +\li print() function: A QML function that prints output to the console. +\li The \l{Console API}{console object}: Implements a subset of the + \l{http://getfirebug.com/wiki/index.php/Console_API}{FireBug Console API}. +\li \l{XMLHttpRequest}, DOMException: Implements a subset of the + \l{http://www.w3.org/TR/XMLHttpRequest/}{W3C XMLHttpRequest specification}. +\endlist + +\note You cannot use the \l {QJSEngine::}{globalObject()} function to change +the global object of a \l QQmlEngine. For more information, see \l {JavaScript Environment Restrictions}. -\target XMLHttpRequest -\section1 XMLHttpRequest - -The XMLHttpRequest object, which can be used to asynchronously obtain -data from over a network. - -The XMLHttpRequest API implements the same \l {http://www.w3.org/TR/XMLHttpRequest/}{W3C standard} -as many popular web browsers with following exceptions: -\list -\li QML's XMLHttpRequest does not enforce the same origin policy. -\endlist - -Additionally, the \c responseXML XML DOM tree currently supported by QML is a reduced subset -of the \l {http://www.w3.org/TR/DOM-Level-3-Core/}{DOM Level 3 Core} API supported in a web -browser. The following objects and properties are supported by the QML implementation: - -\table -\header -\li \b {Node} -\li \b {Document} -\li \b {Element} -\li \b {Attr} -\li \b {CharacterData} -\li \b {Text} - -\row -\li -\list -\li nodeName -\li nodeValue -\li nodeType -\li parentNode -\li childNodes -\li firstChild -\li lastChild -\li previousSibling -\li nextSibling -\li attributes -\endlist - -\li -\list -\li xmlVersion -\li xmlEncoding -\li xmlStandalone -\li documentElement -\endlist - -\li -\list -\li tagName -\endlist - -\li -\list -\li name -\li value -\li ownerElement -\endlist - -\li -\list -\li data -\li length -\endlist - -\li -\list -\li isElementContentWhitespace -\li wholeText -\endlist - -\endtable - -The \l{Qt Quick Examples - XMLHttpRequest}{XMLHttpRequest example} demonstrates -how to use the XMLHttpRequest object to make a request and read the response -headers. - */ |