From 26a6905e8feed42c0886b9ceef96456f2375deee Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 30 Apr 2009 13:47:41 +1000 Subject: Change syntax --- examples/declarative/webview/autosize.qml | 101 +++++++++++++++----------- examples/declarative/webview/inline-html.qml | 25 +++---- examples/declarative/webview/inline-xhtml.qml | 14 ---- examples/declarative/webview/qml-in-html.qml | 50 ++++++++----- examples/declarative/webview/transparent.qml | 17 +++-- 5 files changed, 112 insertions(+), 95 deletions(-) delete mode 100644 examples/declarative/webview/inline-xhtml.qml diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml index fedd497..c32b752 100644 --- a/examples/declarative/webview/autosize.qml +++ b/examples/declarative/webview/autosize.qml @@ -1,42 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// 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: "No width defined." + Rect { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: Rect.width + html: "The width is full." + Rect { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: Rect.width/2 + html: "The width is half." + Rect { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + idealWidth: Rect.width/2 + html: "The idealWidth is half." + Rect { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + idealWidth: Rect.width/2 + html: "The_idealWidth_is_half." + Rect { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: Rect.width/2 + html: "The_width_is_half." + Rect { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/examples/declarative/webview/inline-html.qml b/examples/declarative/webview/inline-html.qml index 701db41..5f6d410 100644 --- a/examples/declarative/webview/inline-html.qml +++ b/examples/declarative/webview/inline-html.qml @@ -1,13 +1,12 @@ - - - - -
OneTwoThree -
1X1X -
20X0 -
3X1X -
- ]]> -
+// Inline HTML with loose formatting can be +// set on the html property. +WebView { + html:"\ + \ + \ +
OneTwoThree\ +
1X1X\ +
20X0\ +
3X1X\ +
" +} diff --git a/examples/declarative/webview/inline-xhtml.qml b/examples/declarative/webview/inline-xhtml.qml deleted file mode 100644 index 4acb417..0000000 --- a/examples/declarative/webview/inline-xhtml.qml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - -
OneTwoThree
1X1X
20X0
3X1X
- - -
diff --git a/examples/declarative/webview/qml-in-html.qml b/examples/declarative/webview/qml-in-html.qml index 8c1c06f..29dded5 100644 --- a/examples/declarative/webview/qml-in-html.qml +++ b/examples/declarative/webview/qml-in-html.qml @@ -1,20 +1,30 @@ - - - - - - These are QML plugins, shown in a QML WebView via HTML OBJECT tags, all scaled to 75% - and placed in a Flickable area... - -
Duration Color Plugin -
500 red -
2000 blue -
1000 green -
- - - ]]> -
-
+// The WebView supports QML data through the HTML OBJECT tag +Rect { + color:"blue" + Flickable { + width: parent.width + height: parent.height/2 + viewportWidth: Web.width*Web.scale + viewportHeight: Web.height*Web.scale + WebView { + id: Web + width: 250 + height: 420 + scale: 0.75 + smooth: true + settings.pluginsEnabled: true + html: "\ + \ + These are QML plugins, shown in a QML WebView via HTML OBJECT tags, all scaled to 75%\ + and placed in a Flickable area...\ + \ +
Duration Color Plugin\ +
500 red \ +
2000 blue \ +
1000 green \ +
\ + \ + " + } + } +} diff --git a/examples/declarative/webview/transparent.qml b/examples/declarative/webview/transparent.qml index 71e1621..8614822 100644 --- a/examples/declarative/webview/transparent.qml +++ b/examples/declarative/webview/transparent.qml @@ -1,6 +1,11 @@ - - - - - +// 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 World!" + } +} -- cgit v0.12