aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-06-06 15:51:14 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-06-08 13:59:50 +0000
commit123f698c5bbf23ad816bf2274620ab4f0a82ed2f (patch)
tree12bbb64f44a4110ab1f2d5124245fefdc845d509 /examples
parentf4f89858cffa1107af5139dfb1e1d7b16ca3a1a0 (diff)
Allow freely mixing non-ShapePath objects in Shape
The own list property must be kept. However, we can reuse QQuickItemPrivate's data accessors in order to start supporting code like: Shape { .. ShapePath { ... } ShapePath { ... } Rectangle { ... } Image { ... } // any other visual type // or non-visual: Timer { ... } } Change-Id: I6d502d697cae37bf16857770273a749cee1b3aa3 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/shapes/content/item1.qml17
-rw-r--r--examples/quick/shapes/content/pathiteminteract.qml8
2 files changed, 21 insertions, 4 deletions
diff --git a/examples/quick/shapes/content/item1.qml b/examples/quick/shapes/content/item1.qml
index 584a310af4..9328979324 100644
--- a/examples/quick/shapes/content/item1.qml
+++ b/examples/quick/shapes/content/item1.qml
@@ -74,5 +74,22 @@ Rectangle {
PathLine { x: 30; y: ctr.height - 30 }
PathLine { x: 30; y: 30 }
}
+
+ // Besides ShapePath, Shape supports visual and non-visual objects too, allowing
+ // free mixing without going through extra hoops:
+ Rectangle {
+ id: testRect
+ color: "green"
+ opacity: 0.3
+ width: 20
+ height: 20
+ anchors.right: parent.right
+ }
+ Timer {
+ interval: 100
+ repeat: true
+ onTriggered: testRect.width = testRect.width > 1 ? testRect.width - 1 : 20
+ running: true
+ }
}
}
diff --git a/examples/quick/shapes/content/pathiteminteract.qml b/examples/quick/shapes/content/pathiteminteract.qml
index b1c9cdf123..55a1d16299 100644
--- a/examples/quick/shapes/content/pathiteminteract.qml
+++ b/examples/quick/shapes/content/pathiteminteract.qml
@@ -195,7 +195,7 @@ Rectangle {
'startX: ' + x + '; startY: ' + y + ';' +
'PathLine { x: ' + x + ' + 1; y: ' + y + ' + 1 } }',
root, "dynamic_visual_path");
- shape.elements.push(p);
+ shape.data.push(p);
activePath = p;
}, "move": function(x, y) {
if (!activePath)
@@ -218,7 +218,7 @@ Rectangle {
'PathCubic { x: ' + x + ' + 1; y: ' + y + ' + 1;' +
'control1X: ' + x + ' + 50; control1Y: ' + y + ' + 50; control2X: ' + x + ' + 150; control2Y: ' + y + ' + 50; } }',
root, "dynamic_visual_path");
- shape.elements.push(p);
+ shape.data.push(p);
activePath = p;
}, "move": function(x, y) {
if (!activePath)
@@ -243,7 +243,7 @@ Rectangle {
'PathQuad { x: ' + x + ' + 1; y: ' + y + ' + 1;' +
'controlX: ' + x + ' + 50; controlY: ' + y + ' + 50 } }',
root, "dynamic_visual_path");
- shape.elements.push(p);
+ shape.data.push(p);
activePath = p;
}, "move": function(x, y) {
if (!activePath)
@@ -279,7 +279,7 @@ Rectangle {
id: shape
anchors.fill: parent
- elements: []
+ data: []
}
}
}