From 1977ed5e1852615cbb2c17aaf9a82b0d983fe2f6 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 4 Jan 2017 14:15:45 +0100 Subject: pathitem example: Add 3 more arc examples Change-Id: I1a5698116bac2c2b7d1ecf692398c478b10663fd Reviewed-by: Andy Nichols --- examples/quick/pathitem/content/item13.qml | 96 ++++++++++++++++++ examples/quick/pathitem/content/item14.qml | 90 +++++++++++++++++ examples/quick/pathitem/content/item15.qml | 112 +++++++++++++++++++++ .../quick/pathitem/content/pathitemgallery.qml | 12 +++ examples/quick/pathitem/pathitem.pro | 5 +- examples/quick/pathitem/pathitem.qrc | 3 + 6 files changed, 317 insertions(+), 1 deletion(-) create mode 100644 examples/quick/pathitem/content/item13.qml create mode 100644 examples/quick/pathitem/content/item14.qml create mode 100644 examples/quick/pathitem/content/item15.qml diff --git a/examples/quick/pathitem/content/item13.qml b/examples/quick/pathitem/content/item13.qml new file mode 100644 index 0000000000..21dfa13ff5 --- /dev/null +++ b/examples/quick/pathitem/content/item13.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.9 // to get PathItem + +Rectangle { + color: "lightGray" + + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + border.color: "gray" + + Repeater { + model: 2 + PathItem { + anchors.fill: parent + + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: PathItem.DashLine + strokeWidth: 4 + + path: Path { + startX: 4; startY: 4 + PathArc { + id: arc + x: 96; y: 96 + radiusX: 100; radiusY: 100 + direction: model.index === 0 ? PathArc.Clockwise : PathArc.Counterclockwise + } + } + } + } + } + + Column { + anchors.right: parent.right + Text { + text: "Clockwise (sweep 1)" + color: "red" + } + Text { + text: "Counter clockwise (sweep 0)" + color: "blue" + } + } +} diff --git a/examples/quick/pathitem/content/item14.qml b/examples/quick/pathitem/content/item14.qml new file mode 100644 index 0000000000..cbda9d4bc4 --- /dev/null +++ b/examples/quick/pathitem/content/item14.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.9 // to get PathItem + +Rectangle { + color: "lightGray" + + Repeater { + model: 2 + PathItem { + width: 200 + height: 200 + anchors.centerIn: parent + + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: PathItem.DashLine + strokeWidth: 4 + + path: Path { + startX: 50; startY: 100 + PathArc { + x: 100; y: 150 + radiusX: 50; radiusY: 50 + useLargeArc: model.index === 1 + } + } + } + } + + Column { + anchors.right: parent.right + Text { + text: "Small" + color: "red" + } + Text { + text: "Large" + color: "blue" + } + } +} diff --git a/examples/quick/pathitem/content/item15.qml b/examples/quick/pathitem/content/item15.qml new file mode 100644 index 0000000000..9c8786b8de --- /dev/null +++ b/examples/quick/pathitem/content/item15.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.9 // to get PathItem + +Rectangle { + color: "lightGray" + + Repeater { + model: 2 + PathItem { + width: 200 + height: 200 + anchors.centerIn: parent + + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: PathItem.DashLine + strokeWidth: 4 + + path: Path { + startX: 50; startY: 100 + PathArc { + x: 150; y: 100 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + } + } + } + } + + Repeater { + model: 2 + PathItem { + width: 200 + height: 200 + anchors.centerIn: parent + + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + + path: Path { + startX: 50; startY: 100 + PathArc { + x: 150; y: 100 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + direction: PathArc.Counterclockwise + } + } + } + } + + Column { + anchors.right: parent.right + Text { + text: "0 degrees" + color: "red" + } + Text { + text: "45 degrees" + color: "blue" + } + } +} diff --git a/examples/quick/pathitem/content/pathitemgallery.qml b/examples/quick/pathitem/content/pathitemgallery.qml index 5a5e6b7188..a412d9b943 100644 --- a/examples/quick/pathitem/content/pathitemgallery.qml +++ b/examples/quick/pathitem/content/pathitemgallery.qml @@ -113,6 +113,18 @@ Rectangle { name: "Gradient spread modes" pathItemUrl: "item12.qml" } + ListElement { + name: "Arc direction" + pathItemUrl: "item13.qml" + } + ListElement { + name: "Large/small arc" + pathItemUrl: "item14.qml" + } + ListElement { + name: "Arc rotation" + pathItemUrl: "item15.qml" + } } property int gridSpacing: 10 diff --git a/examples/quick/pathitem/pathitem.pro b/examples/quick/pathitem/pathitem.pro index 69aa11fa45..ad208a74ab 100644 --- a/examples/quick/pathitem/pathitem.pro +++ b/examples/quick/pathitem/pathitem.pro @@ -17,7 +17,10 @@ OTHER_FILES += content/pathitem.qml \ content/item9.qml \ content/item10.qml \ content/item11.qml \ - content/item12.qml + content/item12.qml \ + content/item13.qml \ + content/item14.qml \ + content/item15.qml target.path = $$[QT_INSTALL_EXAMPLES]/quick/pathitem INSTALLS += target diff --git a/examples/quick/pathitem/pathitem.qrc b/examples/quick/pathitem/pathitem.qrc index fe92d8c007..ae544bd522 100644 --- a/examples/quick/pathitem/pathitem.qrc +++ b/examples/quick/pathitem/pathitem.qrc @@ -19,5 +19,8 @@ content/item10.qml content/item11.qml content/item12.qml + content/item13.qml + content/item14.qml + content/item15.qml -- cgit v1.2.3