summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-12-13 05:46:33 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-12-13 05:46:33 (GMT)
commit047695e49afa1303d8d83c326bfeeaf01297fefe (patch)
tree4c05c843318ed11368bcd70ab5dcb620b926ef18 /src/declarative/qml/qdeclarativeengine.cpp
parent409f60f0f6fd2c2bad6125d0463c812ba1b1180a (diff)
parent18b940539d0633f30ae055feedb48aeb15969814 (diff)
downloadQt-047695e49afa1303d8d83c326bfeeaf01297fefe.zip
Qt-047695e49afa1303d8d83c326bfeeaf01297fefe.tar.gz
Qt-047695e49afa1303d8d83c326bfeeaf01297fefe.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 48bf3d1..3a5fe66 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -262,6 +262,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),
@@ -679,6 +706,9 @@ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const
requests. See the QDeclarativeImageProvider documentation for details on
implementing and using image providers.
+ All required image providers should be added to the engine before any
+ QML sources files are loaded.
+
Note that images loaded from a QDeclarativeImageProvider are cached
by QPixmapCache, similar to any image loaded by QML.