diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-25 03:12:14 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-25 03:12:14 (GMT) |
commit | 020249df9d920e1bf783dd802f66761c4b7e123c (patch) | |
tree | 9bb92d7cca2339465b79a6070584d2dca6e81c15 /examples/declarative/webview | |
parent | e15d5fc7e1a82da38b765e55d040edbdf8621ae2 (diff) | |
parent | a20828a110ad35a7a98a6234ca0013203d9f8b61 (diff) | |
download | Qt-020249df9d920e1bf783dd802f66761c4b7e123c.zip Qt-020249df9d920e1bf783dd802f66761c4b7e123c.tar.gz Qt-020249df9d920e1bf783dd802f66761c4b7e123c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (76 commits)
Qt.Infinite -> Animation.Infinite
Doc fix.
Skip tests for now
Make autotest work on windows.
Remove faulty assert - the precondition is checked for correctly later on
Ensure currentIndex is updated when items inserted before currentIndex
Replace Animation's repeat property with loops.
Fix compile in namespace.
Compile with qtnamespace
Disallow the implicit QDeclarativeGuardedContextData copy constructor
Doc
Fix leak.
StateChangeScript doc.
A StateChangeScript should never be run when leaving the state.
ScriptAction doc.
Rename stateChangeScriptName to scriptName.
Doc
Document QML security considerations.
Fix flicking views at boundary with StricthighlighRange
Fix abort in flipable
...
Diffstat (limited to 'examples/declarative/webview')
-rw-r--r-- | examples/declarative/webview/content/FieldText.qml | 38 | ||||
-rw-r--r-- | examples/declarative/webview/content/Mapping/Map.qml | 7 | ||||
-rwxr-xr-x | examples/declarative/webview/content/Mapping/map.html | 7 | ||||
-rw-r--r-- | examples/declarative/webview/content/SpinSquare.qml | 4 | ||||
-rw-r--r-- | examples/declarative/webview/evalandattach.html | 31 | ||||
-rw-r--r-- | examples/declarative/webview/evalandattach.qml | 55 | ||||
-rw-r--r-- | examples/declarative/webview/googleMaps.qml | 9 | ||||
-rw-r--r-- | examples/declarative/webview/qdeclarative-in-html.qml | 33 |
8 files changed, 40 insertions, 144 deletions
diff --git a/examples/declarative/webview/content/FieldText.qml b/examples/declarative/webview/content/FieldText.qml index d282209..1da9219 100644 --- a/examples/declarative/webview/content/FieldText.qml +++ b/examples/declarative/webview/content/FieldText.qml @@ -10,30 +10,26 @@ Item { signal cancelled signal startEdit - Script { - - function edit() { - if (!mouseGrabbed) { - fieldText.startEdit(); - fieldText.state='editing'; - mouseGrabbed=true; - } - } - - function confirm() { - fieldText.state=''; - fieldText.text = textEdit.text; - mouseGrabbed=false; - fieldText.confirmed(); + function edit() { + if (!mouseGrabbed) { + fieldText.startEdit(); + fieldText.state='editing'; + mouseGrabbed=true; } + } - function reset() { - textEdit.text = fieldText.text; - fieldText.state=''; - mouseGrabbed=false; - fieldText.cancelled(); - } + function confirm() { + fieldText.state=''; + fieldText.text = textEdit.text; + mouseGrabbed=false; + fieldText.confirmed(); + } + function reset() { + textEdit.text = fieldText.text; + fieldText.state=''; + mouseGrabbed=false; + fieldText.cancelled(); } Image { diff --git a/examples/declarative/webview/content/Mapping/Map.qml b/examples/declarative/webview/content/Mapping/Map.qml index 6c3b021..38c42dd 100644 --- a/examples/declarative/webview/content/Mapping/Map.qml +++ b/examples/declarative/webview/content/Mapping/Map.qml @@ -6,16 +6,21 @@ Item { property real latitude: -34.397 property real longitude: 150.644 property string address: "" + property alias status: js.status WebView { id: map anchors.fill: parent url: "map.html" javaScriptWindowObjects: QtObject { + id: js WebView.windowObjectName: "qml" property real lat: page.latitude property real lng: page.longitude property string address: page.address - onAddressChanged: {map.evaluateJavaScript("goToAddress()")} + property string status: "Loading" + onAddressChanged: { if (map.url != "" && map.progress==1) map.evaluateJavaScript("goToAddress()") } } + pressGrabTime: 0 + onLoadFinished: { evaluateJavaScript("goToAddress()"); } } } diff --git a/examples/declarative/webview/content/Mapping/map.html b/examples/declarative/webview/content/Mapping/map.html index 72f426a..a8726fd 100755 --- a/examples/declarative/webview/content/Mapping/map.html +++ b/examples/declarative/webview/content/Mapping/map.html @@ -33,9 +33,14 @@ } if (map) req.bounds = map.getBounds() + window.qml.status = "Loading"; geocoder.geocode(req, function(results, status) { - if (status == google.maps.GeocoderStatus.OK) + if (status == google.maps.GeocoderStatus.OK) { + window.qml.status = "Ready"; goToLatLng(results[0].geometry.location,results[0].geometry.bounds); + } else { + window.qml.status = "Error"; + } }); } } diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml index 466c99e..62c0ce2 100644 --- a/examples/declarative/webview/content/SpinSquare.qml +++ b/examples/declarative/webview/content/SpinSquare.qml @@ -15,10 +15,10 @@ Item { width: root.width height: width } - rotation: NumberAnimation { + NumberAnimation on rotation { from: 0 to: 360 - repeat: true + loops: Animation.Infinite duration: root.period } } diff --git a/examples/declarative/webview/evalandattach.html b/examples/declarative/webview/evalandattach.html deleted file mode 100644 index 48a1c33..0000000 --- a/examples/declarative/webview/evalandattach.html +++ /dev/null @@ -1,31 +0,0 @@ -<body bgcolor=gray onload="ftext.confirmed.connect (ftext_confirmed); "> - <script> - do_it = function () {var oPressed = document.getElementById('pressed'); - oPressed.innerHTML = 'MouseArea in QML clicked!';}; - ftext_confirmed = function () { statusText1.text = ftext.text; var oT = document.getElementById('htmlTextInput'); oT.value = ftext.text } - </script> - <table border=1> - <tr> - <td> </td> - <td id='pressed'></td> - </tr> - <tr> - <td><label for='htmlTextInput'>Type something:</label></td> - <td><input type='text' name='htmlTextInput' size='25' id='htmlTextInput' - onfocus="statusText2.text = 'Focus in html text input.'"></td> - </tr> - <tr> - <td><label for='htmlButton'> </label></td> - <td> - <input type='button' id='htmlButton' value='Push' - onclick="var oText = document.getElementById('htmlTextInput'); statusText1.text = oText.value; ftext.text = oText.value" /> - </tr> - </table> - <p> - Below a qml(QFxItem) object inside webkit: - </p> - <object data=content/FieldText.qml TYPE=application/x-qt-plugin id="ftext_id" text="" label="Cool:" width="200" - objectname="ftext"> - </object> -</body> - diff --git a/examples/declarative/webview/evalandattach.qml b/examples/declarative/webview/evalandattach.qml deleted file mode 100644 index d219d84..0000000 --- a/examples/declarative/webview/evalandattach.qml +++ /dev/null @@ -1,55 +0,0 @@ -import Qt 4.6 -import org.webkit 1.0 - -Item { - height: 640 - width: 360 - Text { - id: teksti - text: webView.statusText1 - anchors.top: parent.top - height: 30 - anchors.left: parent.left - width: parent.width/2 - } - - Text { - id: teksti2 - text: webView.statusText2 - anchors.top: parent.top - height: 30 - anchors.left: teksti.right - anchors.right: parent.right - } - - MouseArea { - anchors.fill: teksti - onClicked: { webView.evaluateJavaScript ("do_it()") } - } - - WebView { - id: webView - property alias statusText1: txt.text - property alias statusText2: txt2.text - anchors.top: teksti.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - focus: true - settings.pluginsEnabled: true - javaScriptWindowObjects: [ - QtObject { - id: txt - WebView.windowObjectName: "statusText1" - property string text: "Click me!" - }, - QtObject { - id: txt2 - WebView.windowObjectName: "statusText2" - property string text: "" - } - ] - url: "evalandattach.html" - } - -} diff --git a/examples/declarative/webview/googleMaps.qml b/examples/declarative/webview/googleMaps.qml index a04fecb..a0926f5 100644 --- a/examples/declarative/webview/googleMaps.qml +++ b/examples/declarative/webview/googleMaps.qml @@ -21,6 +21,7 @@ Map { radius: 5 anchors.bottom: parent.bottom anchors.bottomMargin: 5 + opacity: map.status == "Ready" ? 1 : 0 x: 70 TextInput { id: input @@ -29,4 +30,12 @@ Map { Keys.onReturnPressed: map.address = input.text } } + Text { + id: loading + anchors.centerIn: parent + text: map.status == "Error" ? "Error" : "Loading" + opacity: map.status == "Ready" ? 0 : 1 + font.pixelSize: 30 + Behavior on opacity {NumberAnimation{}} + } } diff --git a/examples/declarative/webview/qdeclarative-in-html.qml b/examples/declarative/webview/qdeclarative-in-html.qml deleted file mode 100644 index 172ea4b..0000000 --- a/examples/declarative/webview/qdeclarative-in-html.qml +++ /dev/null @@ -1,33 +0,0 @@ -import Qt 4.6 -import org.webkit 1.0 - -// The WebView supports QML data through the HTML OBJECT tag -Rectangle { - color:"blue" - Flickable { - width: parent.width - height: parent.height/2 - contentWidth: web.width*web.scale - contentHeight: web.height*web.scale - WebView { - id: web - width: 250 - height: 420 - zoomFactor: 0.75 - smoothCache: true - settings.pluginsEnabled: true - html: "<html>\ - <body bgcolor=white>\ - These are QML plugins, shown in a QML WebView via HTML OBJECT tags, all scaled to 75%\ - and placed in a Flickable area...\ - <table border=1>\ - <tr><th>Duration <th>Color <th>Plugin\ - <tr><td>500 <td>red <td><OBJECT data=content/SpinSquare.qml TYPE=application/x-qt-plugin width=100 height=100 period=500 color=red />\ - <tr><td>2000 <td>blue <td><OBJECT data=content/SpinSquare.qml TYPE=application/x-qt-plugin width=100 height=100 period=2000 color=blue />\ - <tr><td>1000 <td>green <td><OBJECT data=content/SpinSquare.qml TYPE=application/x-qt-plugin width=100 height=100 period=1000 color=green />\ - </table>\ - </body>\ - </html>" - } - } -} |