summaryrefslogtreecommitdiffstats
path: root/examples/declarative/imageelements/borderimage
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/imageelements/borderimage')
-rw-r--r--examples/declarative/imageelements/borderimage/borderimage.qml57
-rw-r--r--examples/declarative/imageelements/borderimage/borderimage.qmlproject16
-rw-r--r--examples/declarative/imageelements/borderimage/content/MyBorderImage.qml50
-rw-r--r--examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml14
-rw-r--r--examples/declarative/imageelements/borderimage/content/bw.pngbin0 -> 1357 bytes
-rw-r--r--examples/declarative/imageelements/borderimage/content/colors-round.sci7
-rw-r--r--examples/declarative/imageelements/borderimage/content/colors-stretch.sci5
-rw-r--r--examples/declarative/imageelements/borderimage/content/colors.pngbin0 -> 1655 bytes
-rw-r--r--examples/declarative/imageelements/borderimage/content/shadow.pngbin0 -> 588 bytes
-rw-r--r--examples/declarative/imageelements/borderimage/shadows.qml24
10 files changed, 173 insertions, 0 deletions
diff --git a/examples/declarative/imageelements/borderimage/borderimage.qml b/examples/declarative/imageelements/borderimage/borderimage.qml
new file mode 100644
index 0000000..c334cea
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/borderimage.qml
@@ -0,0 +1,57 @@
+import Qt 4.7
+import "content"
+
+Rectangle {
+ id: page
+ width: 1030; height: 540
+
+ Grid {
+ anchors.centerIn: parent; spacing: 20
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
+ }
+ }
+}
diff --git a/examples/declarative/imageelements/borderimage/borderimage.qmlproject b/examples/declarative/imageelements/borderimage/borderimage.qmlproject
new file mode 100644
index 0000000..d4909f8
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/borderimage.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}
diff --git a/examples/declarative/imageelements/borderimage/content/MyBorderImage.qml b/examples/declarative/imageelements/borderimage/content/MyBorderImage.qml
new file mode 100644
index 0000000..b47df7b
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/content/MyBorderImage.qml
@@ -0,0 +1,50 @@
+import Qt 4.7
+
+Item {
+ id: container
+
+ property alias horizontalMode: image.horizontalTileMode
+ property alias verticalMode: image.verticalTileMode
+ property alias source: image.source
+
+ property int minWidth
+ property int minHeight
+ property int maxWidth
+ property int maxHeight
+ property int margin
+
+ width: 240; height: 240
+
+ BorderImage {
+ id: image; anchors.centerIn: parent
+
+ SequentialAnimation on width {
+ loops: Animation.Infinite
+ NumberAnimation {
+ from: container.minWidth; to: container.maxWidth
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ NumberAnimation {
+ from: container.maxWidth; to: container.minWidth
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ }
+
+ SequentialAnimation on height {
+ loops: Animation.Infinite
+ NumberAnimation {
+ from: container.minHeight; to: container.maxHeight
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ NumberAnimation {
+ from: container.maxHeight; to: container.minHeight
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ }
+
+ border.top: container.margin
+ border.left: container.margin
+ border.bottom: container.margin
+ border.right: container.margin
+ }
+}
diff --git a/examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml b/examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml
new file mode 100644
index 0000000..629478b
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+Item {
+ property alias color : rectangle.color
+
+ BorderImage {
+ anchors.fill: rectangle
+ anchors { leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 }
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ source: "shadow.png"; smooth: true
+ }
+
+ Rectangle { id: rectangle; anchors.fill: parent }
+}
diff --git a/examples/declarative/imageelements/borderimage/content/bw.png b/examples/declarative/imageelements/borderimage/content/bw.png
new file mode 100644
index 0000000..486eaae
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/content/bw.png
Binary files differ
diff --git a/examples/declarative/imageelements/borderimage/content/colors-round.sci b/examples/declarative/imageelements/borderimage/content/colors-round.sci
new file mode 100644
index 0000000..506f6f5
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/content/colors-round.sci
@@ -0,0 +1,7 @@
+border.left:30
+border.top:30
+border.right:30
+border.bottom:30
+horizontalTileRule:Round
+verticalTileRule:Round
+source:colors.png
diff --git a/examples/declarative/imageelements/borderimage/content/colors-stretch.sci b/examples/declarative/imageelements/borderimage/content/colors-stretch.sci
new file mode 100644
index 0000000..e4989a7
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/content/colors-stretch.sci
@@ -0,0 +1,5 @@
+border.left:30
+border.top:30
+border.right:30
+border.bottom:30
+source:colors.png
diff --git a/examples/declarative/imageelements/borderimage/content/colors.png b/examples/declarative/imageelements/borderimage/content/colors.png
new file mode 100644
index 0000000..dfb62f3
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/content/colors.png
Binary files differ
diff --git a/examples/declarative/imageelements/borderimage/content/shadow.png b/examples/declarative/imageelements/borderimage/content/shadow.png
new file mode 100644
index 0000000..431af85
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/content/shadow.png
Binary files differ
diff --git a/examples/declarative/imageelements/borderimage/shadows.qml b/examples/declarative/imageelements/borderimage/shadows.qml
new file mode 100644
index 0000000..a08d133
--- /dev/null
+++ b/examples/declarative/imageelements/borderimage/shadows.qml
@@ -0,0 +1,24 @@
+import Qt 4.7
+import "content"
+
+Rectangle {
+ id: window
+
+ width: 480; height: 320
+ color: "gray"
+
+ ShadowRectangle {
+ anchors.centerIn: parent; width: 250; height: 250
+ color: "lightsteelblue"
+ }
+
+ ShadowRectangle {
+ anchors.centerIn: parent; width: 200; height: 200
+ color: "steelblue"
+ }
+
+ ShadowRectangle {
+ anchors.centerIn: parent; width: 150; height: 150
+ color: "thistle"
+ }
+}