summaryrefslogtreecommitdiffstats
path: root/examples/declarative/webview/googleMaps.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/webview/googleMaps.qml')
-rw-r--r--examples/declarative/webview/googleMaps.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/declarative/webview/googleMaps.qml b/examples/declarative/webview/googleMaps.qml
new file mode 100644
index 0000000..b5b13bb
--- /dev/null
+++ b/examples/declarative/webview/googleMaps.qml
@@ -0,0 +1,31 @@
+// This example demonstrates how Web services such as Google Maps can be
+// abstracted as QML types. Here we have a "Mapping" module with a "Map"
+// type. The Map type has an address property. Setting that property moves
+// the map. The underlying implementation uses WebView and the Google Maps
+// API, but users from QML don't need to understand the implementation in
+// order to create a Map.
+
+import Qt 4.6
+import "content/Mapping"
+
+Map {
+ id: map
+ width: 300
+ height: 300
+ address: "Paris"
+ Rectangle {
+ color: "white"
+ width: input.width + 20
+ height: input.height + 4
+ radius: 5
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 5
+ x: 70
+ TextInput {
+ id: input
+ text: map.address
+ anchors.centerIn: parent
+ Keys.onReturnPressed: map.address = input.text
+ }
+ }
+}