summaryrefslogtreecommitdiffstats
path: root/examples/declarative/border-image
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-08-06 08:31:37 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-08-06 08:31:37 (GMT)
commita5b6b744b5a06bcd8dc101768466d202f427b2e7 (patch)
tree116fbad7e3eee6590749c6339dcd19efa2eded6b /examples/declarative/border-image
parentc0525981ffb291fc281a2daaafa290d4ff5917f4 (diff)
downloadQt-a5b6b744b5a06bcd8dc101768466d202f427b2e7.zip
Qt-a5b6b744b5a06bcd8dc101768466d202f427b2e7.tar.gz
Qt-a5b6b744b5a06bcd8dc101768466d202f427b2e7.tar.bz2
Add support for CSS-like horizontalTileRule and verticalTileRule to ScaleGrid.
* Simplify and improve QFxImage code by using qDrawBorderPixmap * Add horizontalTileRule and verticalTileRule to .sci files * Add example in example/declarative/border-image
Diffstat (limited to 'examples/declarative/border-image')
-rw-r--r--examples/declarative/border-image/BorderImage.qml36
-rw-r--r--examples/declarative/border-image/animated.qml54
-rw-r--r--examples/declarative/border-image/borders.qml18
-rw-r--r--examples/declarative/border-image/bw.pngbin0 -> 1357 bytes
-rw-r--r--examples/declarative/border-image/colors-round.sci7
-rw-r--r--examples/declarative/border-image/colors-stretch.sci5
-rw-r--r--examples/declarative/border-image/colors.pngbin0 -> 1809 bytes
7 files changed, 120 insertions, 0 deletions
diff --git a/examples/declarative/border-image/BorderImage.qml b/examples/declarative/border-image/BorderImage.qml
new file mode 100644
index 0000000..a809d5d
--- /dev/null
+++ b/examples/declarative/border-image/BorderImage.qml
@@ -0,0 +1,36 @@
+import Qt 4.6
+
+Item {
+ property var horizontalMode : "Stretch"
+ property var verticalMode : "Stretch"
+ property string source
+ property int minWidth
+ property int minHeight
+ property int maxWidth
+ property int maxHeight
+ property int margin
+
+ id: Container
+ width: 240; height: 240
+ Image {
+ x: Container.width / 2 - width / 2
+ y: Container.height / 2 - height / 2
+ width: SequentialAnimation {
+ running: true; repeat: true
+ NumberAnimation { from: Container.minWidth; to: Container.maxWidth; duration: 2000; easing: "easeInOutQuad"}
+ NumberAnimation { from: Container.maxWidth; to: Container.minWidth; duration: 2000; easing: "easeInOutQuad" }
+ }
+ height: SequentialAnimation {
+ running: true; repeat: true
+ NumberAnimation { from: Container.minHeight; to: Container.maxHeight; duration: 2000; easing: "easeInOutQuad"}
+ NumberAnimation { from: Container.maxHeight; to: Container.minHeight; duration: 2000; easing: "easeInOutQuad" }
+ }
+ source: Container.source
+ scaleGrid.horizontalTileRule: Container.horizontalMode
+ scaleGrid.verticalTileRule: Container.verticalMode
+ scaleGrid.top: Container.margin
+ scaleGrid.left: Container.margin
+ scaleGrid.bottom: Container.margin
+ scaleGrid.right: Container.margin
+ }
+}
diff --git a/examples/declarative/border-image/animated.qml b/examples/declarative/border-image/animated.qml
new file mode 100644
index 0000000..58eb44c
--- /dev/null
+++ b/examples/declarative/border-image/animated.qml
@@ -0,0 +1,54 @@
+import Qt 4.6
+
+Rect {
+ id: Page
+ color: "white"
+ width: 1030; height: 540
+
+ BorderImage {
+ x: 20; y: 20; minWidth: 120; maxWidth: 240
+ minHeight: 120; maxHeight: 240
+ source: "colors.png"; margin: 30
+ }
+ BorderImage {
+ x: 270; y: 20; minWidth: 120; maxWidth: 240
+ minHeight: 120; maxHeight: 240
+ source: "colors.png"; margin: 30
+ horizontalMode: "Repeat"; verticalMode: "Repeat"
+ }
+ BorderImage {
+ x: 520; y: 20; minWidth: 120; maxWidth: 240
+ minHeight: 120; maxHeight: 240
+ source: "colors.png"; margin: 30
+ horizontalMode: "Stretch"; verticalMode: "Repeat"
+ }
+ BorderImage {
+ x: 770; y: 20; minWidth: 120; maxWidth: 240
+ minHeight: 120; maxHeight: 240
+ source: "colors.png"; margin: 30
+ horizontalMode: "Round"; verticalMode: "Round"
+ }
+ BorderImage {
+ x: 20; y: 280; minWidth: 60; maxWidth: 200
+ minHeight: 40; maxHeight: 200
+ source: "bw.png"; margin: 10
+ }
+ BorderImage {
+ x: 270; y: 280; minWidth: 60; maxWidth: 200
+ minHeight: 40; maxHeight: 200
+ source: "bw.png"; margin: 10
+ horizontalMode: "Repeat"; verticalMode: "Repeat"
+ }
+ BorderImage {
+ x: 520; y: 280; minWidth: 60; maxWidth: 200
+ minHeight: 40; maxHeight: 200
+ source: "bw.png"; margin: 10
+ horizontalMode: "Stretch"; verticalMode: "Repeat"
+ }
+ BorderImage {
+ x: 770; y: 280; minWidth: 60; maxWidth: 200
+ minHeight: 40; maxHeight: 200
+ source: "bw.png"; margin: 10
+ horizontalMode: "Round"; verticalMode: "Round"
+ }
+}
diff --git a/examples/declarative/border-image/borders.qml b/examples/declarative/border-image/borders.qml
new file mode 100644
index 0000000..a4a329b
--- /dev/null
+++ b/examples/declarative/border-image/borders.qml
@@ -0,0 +1,18 @@
+import Qt 4.6
+
+Rect {
+ id: Page
+ color: "white"
+ width: 520; height: 280
+
+ Image {
+ x: 20; y: 20; width: 230; height: 240
+ smooth: true
+ source: "colors-stretch.sci"
+ }
+ Image {
+ x: 270; y: 20; width: 230; height: 240
+ smooth: true
+ source: "colors-round.sci"
+ }
+}
diff --git a/examples/declarative/border-image/bw.png b/examples/declarative/border-image/bw.png
new file mode 100644
index 0000000..486eaae
--- /dev/null
+++ b/examples/declarative/border-image/bw.png
Binary files differ
diff --git a/examples/declarative/border-image/colors-round.sci b/examples/declarative/border-image/colors-round.sci
new file mode 100644
index 0000000..3784e10
--- /dev/null
+++ b/examples/declarative/border-image/colors-round.sci
@@ -0,0 +1,7 @@
+gridLeft:30
+gridTop:30
+gridRight:30
+gridBottom:30
+horizontalTileRule:Round
+verticalTileRule:Round
+imageFile:colors.png
diff --git a/examples/declarative/border-image/colors-stretch.sci b/examples/declarative/border-image/colors-stretch.sci
new file mode 100644
index 0000000..c693599
--- /dev/null
+++ b/examples/declarative/border-image/colors-stretch.sci
@@ -0,0 +1,5 @@
+gridLeft:30
+gridTop:30
+gridRight:30
+gridBottom:30
+imageFile:colors.png
diff --git a/examples/declarative/border-image/colors.png b/examples/declarative/border-image/colors.png
new file mode 100644
index 0000000..c0e137c
--- /dev/null
+++ b/examples/declarative/border-image/colors.png
Binary files differ