summaryrefslogtreecommitdiffstats
path: root/examples/declarative/webview
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
commit2366667fc97eb6a56203b2dd7dac776ff4164abd (patch)
treeb2acb6cc6bfe475d7e619e4788973b61fff775e0 /examples/declarative/webview
parent2c762f3b8b284a7c6dc0c499b7052013bad5b707 (diff)
downloadQt-2366667fc97eb6a56203b2dd7dac776ff4164abd.zip
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.gz
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.bz2
Initial import of kinetic-dui branch from the old kinetic
Diffstat (limited to 'examples/declarative/webview')
-rw-r--r--examples/declarative/webview/autosize.qml42
-rw-r--r--examples/declarative/webview/content/SpinSquare.qml12
-rw-r--r--examples/declarative/webview/inline-html.qml13
-rw-r--r--examples/declarative/webview/inline-xhtml.qml14
-rw-r--r--examples/declarative/webview/qml-in-html.qml20
-rw-r--r--examples/declarative/webview/transparent.qml6
6 files changed, 107 insertions, 0 deletions
diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml
new file mode 100644
index 0000000..fedd497
--- /dev/null
+++ b/examples/declarative/webview/autosize.qml
@@ -0,0 +1,42 @@
+<!-- The WebView size is determined by the width, height,
+ idealWidth, and idealHeight properties. -->
+<Rect id="Rect" color="white" width="200" height="{Layout.height}">
+ <VerticalLayout id="Layout" spacing="2">
+ <WebView>
+ <html><![CDATA[
+ No width defined.
+ ]]></html>
+ <Rect color="#10000000" anchors.fill="{parent}"/>
+ </WebView>
+ <WebView width="{Rect.width}">
+ <html><![CDATA[
+ The width is full.
+ ]]></html>
+ <Rect color="#10000000" anchors.fill="{parent}"/>
+ </WebView>
+ <WebView width="{Rect.width/2}">
+ <html><![CDATA[
+ The width is half.
+ ]]></html>
+ <Rect color="#10000000" anchors.fill="{parent}"/>
+ </WebView>
+ <WebView idealWidth="{Rect.width/2}">
+ <html><![CDATA[
+ The idealWidth is half.
+ ]]></html>
+ <Rect color="#10000000" anchors.fill="{parent}"/>
+ </WebView>
+ <WebView idealWidth="{Rect.width/2}">
+ <html><![CDATA[
+ The_idealWidth_is_half.
+ ]]></html>
+ <Rect color="#10000000" anchors.fill="{parent}"/>
+ </WebView>
+ <WebView width="{Rect.width/2}">
+ <html><![CDATA[
+ The_width_is_half.
+ ]]></html>
+ <Rect color="#10000000" anchors.fill="{parent}"/>
+ </WebView>
+ </VerticalLayout>
+</Rect>
diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml
new file mode 100644
index 0000000..ced45d5
--- /dev/null
+++ b/examples/declarative/webview/content/SpinSquare.qml
@@ -0,0 +1,12 @@
+<Item id="Root">
+ <properties>
+ <Property name="period" value="250"/>
+ <Property name="color" value="black"/>
+ </properties>
+ <Item x="{Root.width/2}" y="{Root.height/2}">
+ <Rect color="{Root.color}" width="{Root.width}" height="{width}" x="{-width/2}" y="{-height/2}"/>
+ <rotation>
+ <NumericAnimation from="0" to="360" repeat="true" running="true" duration="{Root.period}"/>
+ </rotation>
+ </Item>
+</Item>
diff --git a/examples/declarative/webview/inline-html.qml b/examples/declarative/webview/inline-html.qml
new file mode 100644
index 0000000..701db41
--- /dev/null
+++ b/examples/declarative/webview/inline-html.qml
@@ -0,0 +1,13 @@
+<!-- Inline HTML with loose formatting can be
+ set on the html property by using CDATA. -->
+<WebView>
+ <html><![CDATA[
+ <body bgcolor="white">
+ <table border=1>
+ <tr><th><th>One<th>Two<th>Three
+ <tr><th>1<td>X<td>1<td>X
+ <tr><th>2<td>0<td>X<td>0
+ <tr><th>3<td>X<td>1<td>X
+ </table>
+ ]]></html>
+</WebView>
diff --git a/examples/declarative/webview/inline-xhtml.qml b/examples/declarative/webview/inline-xhtml.qml
new file mode 100644
index 0000000..4acb417
--- /dev/null
+++ b/examples/declarative/webview/inline-xhtml.qml
@@ -0,0 +1,14 @@
+<!-- Inline xHTML (with strict XML formatting) can be
+ set on the html property by giving it the appropriate namespace. -->
+<WebView>
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <body bgcolor="white">
+ <table border="1">
+ <tr><th></th><th>One</th><th>Two</th><th>Three</th></tr>
+ <tr><th>1</th><td>X</td><td>1</td><td>X</td></tr>
+ <tr><th>2</th><td>0</td><td>X</td><td>0</td></tr>
+ <tr><th>3</th><td>X</td><td>1</td><td>X</td></tr>
+ </table>
+ </body>
+ </html>
+</WebView>
diff --git a/examples/declarative/webview/qml-in-html.qml b/examples/declarative/webview/qml-in-html.qml
new file mode 100644
index 0000000..2715788
--- /dev/null
+++ b/examples/declarative/webview/qml-in-html.qml
@@ -0,0 +1,20 @@
+<!-- The WebView supports QML data through the HTML OBJECT tag -->
+<Flickable width="{250*.75}" height="240"
+ viewportWidth="{Web.width*Web.scale}" viewportHeight="{Web.height*Web.scale}">
+<WebView id="Web" width="250" height="420" scale="0.75">
+ <html><![CDATA[
+ <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>
+ ]]></html>
+</WebView>
+</Flickable>
diff --git a/examples/declarative/webview/transparent.qml b/examples/declarative/webview/transparent.qml
new file mode 100644
index 0000000..71e1621
--- /dev/null
+++ b/examples/declarative/webview/transparent.qml
@@ -0,0 +1,6 @@
+<!-- The WebView background is transparent
+ if the HTML does not specify a background -->
+
+<Rect color="green" width="{Web.width}" height="{Web.height}">
+ <WebView id="Web" html="Hello &lt;b&gt;World!&lt;/b&gt;"/>
+</Rect>