summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-12-06 02:46:35 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-12-06 02:48:06 (GMT)
commitac977c4d57eba8fe2b71e51fc3d0b5eddd416e17 (patch)
treee5d56c027d90957654e61c724051b431a387d00b /src/declarative/qml/qdeclarativeengine.cpp
parentdb506f31cf98d050aef10534fb5dad7058f64caf (diff)
downloadQt-ac977c4d57eba8fe2b71e51fc3d0b5eddd416e17.zip
Qt-ac977c4d57eba8fe2b71e51fc3d0b5eddd416e17.tar.gz
Qt-ac977c4d57eba8fe2b71e51fc3d0b5eddd416e17.tar.bz2
Qt.include() docs weren't being picked up by qdoc
This moves the Qt.include() docs to qdeclarativeengine.cpp and also documents it in the "Integrating JavaScript" page. Task-number: QTBUG-15855
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index a8404f0..201e675 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -261,6 +261,33 @@ of their use.
\endlist
*/
+/*!
+\qmlmethod object Qt::include(string url, jsobject callback)
+
+Includes another JavaScript file. This method can only be used from within JavaScript files,
+and not regular QML files.
+
+This imports all functions from \a url into the current script's namespace.
+
+Qt.include() returns an object that describes the status of the operation. The object has
+a single property, \c {status}, that is set to one of the following values:
+
+\table
+\header \o Symbol \o Value \o Description
+\row \o result.OK \o 0 \o The include completed successfully.
+\row \o result.LOADING \o 1 \o Data is being loaded from the network.
+\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url.
+\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code.
+An additional \c exception property will be set in this case.
+\endtable
+
+The \c status property will be updated as the operation progresses.
+
+If provided, \a callback is invoked when the operation completes. The callback is passed
+the same object as is returned from the Qt.include() call.
+*/
+// Qt.include() is implemented in qdeclarativeinclude.cpp
+
QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
: captureProperties(false), rootContext(0), isDebugging(false),