diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-02 15:12:05 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-07 08:33:33 +0000 |
commit | 5af4c9b237a23ce12ca7c56eb6c9ecda17743228 (patch) | |
tree | fe8f85d5c353216cddc18df3c996be0c50cf0c67 /tests/manual | |
parent | 961da5273e17655e73ec0975c6de446b88d7f5ca (diff) |
Reduce objects: Make ShapePath inherit Path
Shape { ShapePath { Path { ... } } } simply becomes
Shape { ShapePath { ... } }
Change-Id: Ie57936cd7953c8a8d6c67e78b9d73bdbe2a05316
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/shapestest/shapestest.qml | 114 |
1 files changed, 46 insertions, 68 deletions
diff --git a/tests/manual/shapestest/shapestest.qml b/tests/manual/shapestest/shapestest.qml index 0971ea9da1..bf503c12d9 100644 --- a/tests/manual/shapestest/shapestest.qml +++ b/tests/manual/shapestest/shapestest.qml @@ -95,11 +95,9 @@ Rectangle { fillColor: "blue" // ignored with the gradient set strokeStyle: ShapePath.DashLine dashPattern: [ 1, 4 ] - Path { - PathLine { x: 200; y: 100 } - PathLine { x: 0; y: 100 } - PathLine { x: 0; y: 0 } - } + PathLine { x: 200; y: 100 } + PathLine { x: 0; y: 100 } + PathLine { x: 0; y: 0 } } transform: Rotation { origin.x: 100; origin.y: 50; axis { x: 0; y: 1; z: 0 } SequentialAnimation on angle { @@ -125,13 +123,11 @@ Rectangle { strokeColor: sc property color fc: "yellow" fillColor: fc - Path { - startX: 20; startY: 10 - PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } - PathLine { x: 150; y: 80 } - PathQuad { x: 180; y: 10; controlX: 200; controlY: 80 } - PathLine { x: 20; y: 10 } - } + startX: 20; startY: 10 + PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } + PathLine { x: 150; y: 80 } + PathQuad { x: 180; y: 10; controlX: 200; controlY: 80 } + PathLine { x: 20; y: 10 } // Dynamic changes via property bindings etc. all work but can // be computationally expense with the generic backend for properties // that need retriangulating on every change. Should be cheap with NVPR. @@ -168,12 +164,10 @@ Rectangle { anchors.fill: parent ShapePath { strokeColor: "black" - Path { - startX: 0; startY: 50 - PathLine { relativeX: 100; y: 50 } - PathMove { relativeX: 100; y: 50 } - PathLine { relativeX: 100; y: 50 } - } + startX: 0; startY: 50 + PathLine { relativeX: 100; y: 50 } + PathMove { relativeX: 100; y: 50 } + PathLine { relativeX: 100; y: 50 } } } } @@ -191,12 +185,10 @@ Rectangle { strokeWidth: 16 fillColor: "transparent" capStyle: ShapePath.RoundCap - Path { - startX: 30 - startY: 30 - PathLine { x: 100; y: 100 } - PathLine { x: 30; y: 100 } - } + startX: 30 + startY: 30 + PathLine { x: 100; y: 100 } + PathLine { x: 30; y: 100 } } } Timer { @@ -226,14 +218,12 @@ Rectangle { strokeColor: "blue" fillColor: "lightGray" strokeWidth: 2 - Path { - PathMove { x: 90; y: 50 } - PathLine { x: 50 + 40 * Math.cos(0.8 * 1 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 1 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 2 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 2 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 3 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 3 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 4 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 4 * Math.PI) } - PathLine { x: 90; y: 50 } - } + PathMove { x: 90; y: 50 } + PathLine { x: 50 + 40 * Math.cos(0.8 * 1 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 1 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 2 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 2 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 3 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 3 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 4 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 4 * Math.PI) } + PathLine { x: 90; y: 50 } } } Timer { @@ -255,14 +245,12 @@ Rectangle { strokeWidth: 4 strokeColor: "black" fillColor: "transparent" - Path { - startX: 20; startY: 10 - PathCubic { - id: cb - x: 180; y: 10 - control1X: -10; control1Y: 90; control2Y: 90 - NumberAnimation on control2X { from: 400; to: 0; duration: 5000; loops: Animation.Infinite } - } + startX: 20; startY: 10 + PathCubic { + id: cb + x: 180; y: 10 + control1X: -10; control1Y: 90; control2Y: 90 + NumberAnimation on control2X { from: 400; to: 0; duration: 5000; loops: Animation.Infinite } } } } @@ -283,13 +271,11 @@ Rectangle { fillColor: "transparent" strokeColor: "red" strokeWidth: 4 - Path { - startX: 10; startY: 40 - PathArc { - x: 10; y: 60 - radiusX: 40; radiusY: 40 - useLargeArc: true - } + startX: 10; startY: 40 + PathArc { + x: 10; y: 60 + radiusX: 40; radiusY: 40 + useLargeArc: true } } } @@ -320,12 +306,10 @@ Rectangle { fillColor: "blue" strokeColor: "red" strokeWidth: 4 - Path { - startX: 10; startY: 10 - PathLine { x: 140; y: 140 } - PathLine { x: 10; y: 140 } - PathLine { x: 10; y: 10 } - } + startX: 10; startY: 10 + PathLine { x: 140; y: 140 } + PathLine { x: 10; y: 140 } + PathLine { x: 10; y: 10 } } } } @@ -353,14 +337,12 @@ Rectangle { strokeColor: "blue" fillColor: "lightGray" strokeWidth: 2 - Path { - PathMove { x: 90; y: 50 } - PathLine { x: 50 + 40 * Math.cos(0.8 * 1 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 1 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 2 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 2 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 3 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 3 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 4 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 4 * Math.PI) } - PathLine { x: 90; y: 50 } - } + PathMove { x: 90; y: 50 } + PathLine { x: 50 + 40 * Math.cos(0.8 * 1 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 1 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 2 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 2 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 3 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 3 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 4 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 4 * Math.PI) } + PathLine { x: 90; y: 50 } } } Timer { @@ -381,16 +363,12 @@ Rectangle { anchors.fill: parent ShapePath { strokeColor: "red" - Path { - PathLine { x: 100; y: 100 } - } + PathLine { x: 100; y: 100 } } ShapePath { strokeColor: "blue" - Path { - startX: 100; startY: 0 - PathLine { x: 0; y: 100 } - } + startX: 100; startY: 0 + PathLine { x: 0; y: 100 } } } } |