summaryrefslogtreecommitdiffstats
path: root/examples/declarative/webview/autosize.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/webview/autosize.qml')
-rw-r--r--examples/declarative/webview/autosize.qml60
1 files changed, 60 insertions, 0 deletions
diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml
new file mode 100644
index 0000000..1614906
--- /dev/null
+++ b/examples/declarative/webview/autosize.qml
@@ -0,0 +1,60 @@
+import Qt 4.6
+
+// The WebView size is determined by the width, height,
+// preferredWidth, and preferredHeight matchProperties.
+Rectangle {
+ id: rect
+ color: "white"
+ width: 200
+ height: layout.height
+ Column {
+ id: layout
+ spacing: 2
+ WebView {
+ html: "No width defined."
+ Rectangle { color: "#10000000"
+ anchors.fill: parent
+ }
+ }
+ WebView {
+ width: rect.width
+ html: "The width is full."
+ Rectangle {
+ color: "#10000000"
+ anchors.fill: parent
+ }
+ }
+ WebView {
+ width: rect.width/2
+ html: "The width is half."
+ Rectangle {
+ color: "#10000000"
+ anchors.fill: parent
+ }
+ }
+ WebView {
+ preferredWidth: rect.width/2
+ html: "The preferredWidth is half."
+ Rectangle {
+ color: "#10000000"
+ anchors.fill: parent
+ }
+ }
+ WebView {
+ preferredWidth: rect.width/2
+ html: "The_preferredWidth_is_half."
+ Rectangle {
+ color: "#10000000"
+ anchors.fill: parent
+ }
+ }
+ WebView {
+ width: rect.width/2
+ html: "The_width_is_half."
+ Rectangle {
+ color: "#10000000"
+ anchors.fill: parent
+ }
+ }
+ }
+}