summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2009-08-04 04:18:34 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2009-08-04 04:18:34 (GMT)
commitc77a478f5dad857074a79cf1b6fd2a76972bce1a (patch)
tree430a01e67a94d2b62aa873612542f2d588e04d85 /examples
parentf909983982d412fb3ea3b221dd31b23e40db748f (diff)
downloadQt-c77a478f5dad857074a79cf1b6fd2a76972bce1a.zip
Qt-c77a478f5dad857074a79cf1b6fd2a76972bce1a.tar.gz
Qt-c77a478f5dad857074a79cf1b6fd2a76972bce1a.tar.bz2
Example of smooth rect painting
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/smooth/GradientRect.qml25
-rw-r--r--examples/declarative/smooth/MyRect.qml21
-rw-r--r--examples/declarative/smooth/rect-painting.qml64
3 files changed, 110 insertions, 0 deletions
diff --git a/examples/declarative/smooth/GradientRect.qml b/examples/declarative/smooth/GradientRect.qml
new file mode 100644
index 0000000..267a487
--- /dev/null
+++ b/examples/declarative/smooth/GradientRect.qml
@@ -0,0 +1,25 @@
+import Qt 4.6
+
+Item {
+ id: MyRect
+ property string color
+ property string border : ""
+ property int rotation
+ property int radius
+ property int borderWidth
+ property bool smooth: false
+
+ width: 80; height: 80
+ Item {
+ anchors.centerIn: parent; rotation: MyRect.rotation;
+ Rect {
+ anchors.centerIn: parent; width: 80; height: 80
+ border.color: MyRect.border; border.width: MyRect.border != "" ? 2 : 0
+ radius: MyRect.radius; smooth: MyRect.smooth
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: MyRect.color }
+ GradientStop { position: 1.0; color: "white" }
+ }
+ }
+ }
+}
diff --git a/examples/declarative/smooth/MyRect.qml b/examples/declarative/smooth/MyRect.qml
new file mode 100644
index 0000000..7791e27
--- /dev/null
+++ b/examples/declarative/smooth/MyRect.qml
@@ -0,0 +1,21 @@
+import Qt 4.6
+
+Item {
+ id: MyRect
+ property string color
+ property string border : ""
+ property int rotation
+ property int radius
+ property int borderWidth
+ property bool smooth: false
+
+ width: 80; height: 80
+ Item {
+ anchors.centerIn: parent; rotation: MyRect.rotation;
+ Rect {
+ anchors.centerIn: parent; width: 80; height: 80
+ color: MyRect.color; border.color: MyRect.border; border.width: MyRect.border != "" ? 2 : 0
+ radius: MyRect.radius; smooth: MyRect.smooth
+ }
+ }
+}
diff --git a/examples/declarative/smooth/rect-painting.qml b/examples/declarative/smooth/rect-painting.qml
new file mode 100644
index 0000000..2f01e4b
--- /dev/null
+++ b/examples/declarative/smooth/rect-painting.qml
@@ -0,0 +1,64 @@
+import Qt 4.6
+
+Rect {
+ width: 900; height: 500
+ color: "white"
+
+ Rect {
+ anchors.top: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ color: "#eeeeee"
+ }
+
+ GridLayout {
+ anchors.centerIn: parent
+ columns: 8; rows:4; spacing: 30
+
+ MyRect { color: "lightsteelblue" }
+ MyRect { color: "lightsteelblue"; border: "gray" }
+ MyRect { color: "lightsteelblue"; radius: 10 }
+ MyRect { color: "lightsteelblue"; radius: 10; border: "gray" }
+ GradientRect { color: "lightsteelblue" }
+ GradientRect { color: "lightsteelblue"; border: "gray" }
+ GradientRect { color: "lightsteelblue"; radius: 10 }
+ GradientRect { color: "lightsteelblue"; radius: 10; border: "gray" }
+
+ MyRect { color: "thistle"; rotation: 10 }
+ MyRect { color: "thistle"; border: "gray"; rotation: 10 }
+ MyRect { color: "thistle"; radius: 10; rotation: 10 }
+ MyRect { color: "thistle"; radius: 10; border: "gray"; rotation: 10 }
+ GradientRect { color: "thistle"; rotation: 10 }
+ GradientRect { color: "thistle"; border: "gray"; rotation: 10 }
+ GradientRect { color: "thistle"; radius: 10; rotation: 10 }
+ GradientRect { color: "thistle"; radius: 10; border: "gray"; rotation: 10 }
+
+ MyRect { color: "lightsteelblue"; smooth: true }
+ MyRect { color: "lightsteelblue"; border: "gray"; smooth: true }
+ MyRect { color: "lightsteelblue"; radius: 10; smooth: true }
+ MyRect { color: "lightsteelblue"; radius: 10; border: "gray"; smooth: true }
+ GradientRect { color: "lightsteelblue"; smooth: true }
+ GradientRect { color: "lightsteelblue"; border: "gray"; smooth: true }
+ GradientRect { color: "lightsteelblue"; radius: 10; smooth: true }
+ GradientRect { color: "lightsteelblue"; radius: 10; border: "gray"; smooth: true }
+
+ MyRect { color: "thistle"; rotation: 10; smooth: true }
+ MyRect { color: "thistle"; border: "gray"; rotation: 10; smooth: true }
+ MyRect { color: "thistle"; radius: 10; rotation: 10; smooth: true }
+ MyRect { color: "thistle"; radius: 10; border: "gray"; rotation: 10; smooth: true }
+ GradientRect { color: "thistle"; rotation: 10; smooth: true }
+ GradientRect { color: "thistle"; border: "gray"; rotation: 10; smooth: true }
+ GradientRect { color: "thistle"; radius: 10; rotation: 10; smooth: true }
+ GradientRect { color: "thistle"; radius: 10; border: "gray"; rotation: 10; smooth: true }
+ }
+
+ Text {
+ text: "smooth: false"; font.bold: true
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.top: parent.top
+ }
+ Text {
+ text: "smooth: true"; font.bold: true
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom
+ }
+}