summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-05-07 06:20:45 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-05-07 06:20:45 (GMT)
commit67bf465253db71c0eddbc6ffcb811dd65c00b207 (patch)
tree6683844454f67032e5f85be77e076d6282ccf603 /src/imports
parent4976130171033abdd8323a19229dcbfc5b008cfe (diff)
parentbdfa2d47fa1a6abee6e966f82fadf7a3d97bab0b (diff)
downloadQt-67bf465253db71c0eddbc6ffcb811dd65c00b207.zip
Qt-67bf465253db71c0eddbc6ffcb811dd65c00b207.tar.gz
Qt-67bf465253db71c0eddbc6ffcb811dd65c00b207.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/imports.pro2
-rw-r--r--src/imports/webkit/qdeclarativewebview.cpp33
2 files changed, 25 insertions, 10 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 1754908..a9d600e 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS += particles
+SUBDIRS += particles gestures
contains(QT_CONFIG, webkit): SUBDIRS += webkit
contains(QT_CONFIG, mediaservices): SUBDIRS += multimedia
diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp
index 5db812c..9571470 100644
--- a/src/imports/webkit/qdeclarativewebview.cpp
+++ b/src/imports/webkit/qdeclarativewebview.cpp
@@ -437,24 +437,39 @@ void QDeclarativeWebView::paintPage(const QRect& r)
/*!
\qmlproperty list<object> WebView::javaScriptWindowObjects
- This property is a list of object that are available from within
- the webview's JavaScript context.
+ A list of QML objects to expose to the web page.
- The \a object will be inserted as a child of the frame's window
- object, under the name given by the attached property \c WebView.windowObjectName.
+ Each object will be added as a property of the web frame's window object. The
+ property name is controlled by the value of \c WebView.windowObjectName
+ attached property.
+
+ Exposing QML objects to a web page allows JavaScript executing in the web
+ page itself to communicate with QML, by reading and writing properties and
+ by calling methods of the exposed QML objects.
+
+ This example shows how to call into a QML method using a window object.
\qml
WebView {
- javaScriptWindowObjects: Object {
- WebView.windowObjectName: "coordinates"
+ javaScriptWindowObjects: QtObject {
+ WebView.windowObjectName: "qml"
+
+ function qmlCall() {
+ console.log("This call is in QML!");
+ }
}
+
+ html: "<script>console.log(\"This is in WebKit!\"); window.qml.qmlCall();</script>"
}
\endqml
- Properties of the object will be exposed as JavaScript properties and slots as
- JavaScript methods.
+ The output of the example will be:
+ \code
+ This is in WebKit!
+ This call is in QML!
+ \endcode
- If Javascript is not enabled for this page, then this property does nothing.
+ If Javascript is not enabled for the page, then this property does nothing.
*/
QDeclarativeListProperty<QObject> QDeclarativeWebView::javaScriptWindowObjects()
{