From f4f89858cffa1107af5139dfb1e1d7b16ca3a1a0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 6 Jun 2017 14:54:37 +0200 Subject: Use GradientStop and rename ShapeLinearGradient to LinearGradient Thus application code becomes: ShapePath { ... fillGradient: LinearGradient { ... GradientStop { ... } } } which is even more clean and readable. The duplication for stops is now avoided. Change-Id: I50ae2f388e21683a37dc4787763dc71e16eef4f5 Reviewed-by: Mitch Curtis Reviewed-by: J-P Nurmi --- tests/auto/quick/qquickshape/data/pathitem3.qml | 12 ++++++------ tests/auto/quick/qquickshape/data/pathitem4.qml | 6 +++--- tests/auto/quick/qquickshape/tst_qquickshape.cpp | 7 +++---- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'tests/auto/quick/qquickshape') diff --git a/tests/auto/quick/qquickshape/data/pathitem3.qml b/tests/auto/quick/qquickshape/data/pathitem3.qml index 3b819991e6..fccd1aa2de 100644 --- a/tests/auto/quick/qquickshape/data/pathitem3.qml +++ b/tests/auto/quick/qquickshape/data/pathitem3.qml @@ -13,14 +13,14 @@ Item { ShapePath { strokeWidth: 4 strokeColor: "red" - fillGradient: ShapeLinearGradient { + fillGradient: LinearGradient { x1: 20; y1: 20 x2: 180; y2: 130 - ShapeGradientStop { position: 0; color: "blue" } - ShapeGradientStop { position: 0.2; color: "green" } - ShapeGradientStop { position: 0.4; color: "red" } - ShapeGradientStop { position: 0.6; color: "yellow" } - ShapeGradientStop { position: 1; color: "cyan" } + GradientStop { position: 0; color: "blue" } + GradientStop { position: 0.2; color: "green" } + GradientStop { position: 0.4; color: "red" } + GradientStop { position: 0.6; color: "yellow" } + GradientStop { position: 1; color: "cyan" } } strokeStyle: ShapePath.DashLine dashPattern: [ 1, 4 ] diff --git a/tests/auto/quick/qquickshape/data/pathitem4.qml b/tests/auto/quick/qquickshape/data/pathitem4.qml index 26e7084b8d..1d769051ee 100644 --- a/tests/auto/quick/qquickshape/data/pathitem4.qml +++ b/tests/auto/quick/qquickshape/data/pathitem4.qml @@ -28,10 +28,10 @@ Item { } ShapePath { - fillGradient: ShapeLinearGradient { + fillGradient: LinearGradient { y2: 150 - ShapeGradientStop { position: 0; color: "yellow" } - ShapeGradientStop { position: 1; color: "green" } + GradientStop { position: 0; color: "yellow" } + GradientStop { position: 1; color: "green" } } startX: 10; startY: 100 diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp index fecac573b7..a984c28732 100644 --- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp +++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp @@ -65,9 +65,8 @@ tst_QQuickShape::tst_QQuickShape() const char *uri = "tst_qquickpathitem"; qmlRegisterType(uri, 1, 0, "Shape"); qmlRegisterType(uri, 1, 0, "ShapePath"); - qmlRegisterType(uri, 1, 0, "ShapeGradientStop"); qmlRegisterUncreatableType(uri, 1, 0, "ShapeGradient", QQuickShapeGradient::tr("ShapeGradient is an abstract base class")); - qmlRegisterType(uri, 1, 0, "ShapeLinearGradient"); + qmlRegisterType(uri, 1, 0, "LinearGradient"); } void tst_QQuickShape::initValues() @@ -206,9 +205,9 @@ void tst_QQuickShape::changeSignals() QCOMPARE(vpChangeSpy.count(), 14); QQmlListReference stopList(lgrad, "stops"); QCOMPARE(stopList.count(), 5); - qobject_cast(stopList.at(1))->setPosition(0.3); + qobject_cast(stopList.at(1))->setPosition(0.3); QCOMPARE(vpChangeSpy.count(), 15); - qobject_cast(stopList.at(1))->setColor(Qt::black); + qobject_cast(stopList.at(1))->setColor(Qt::black); QCOMPARE(vpChangeSpy.count(), 16); } -- cgit v1.2.3