summaryrefslogtreecommitdiffstats
path: root/examples/scxml/trafficlight-qml-simple/Light.qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-08-24 15:01:54 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-08-25 12:45:58 +0000
commit4b0e41ade98f1540018b0388eea071a0a6c8c429 (patch)
treeeb0b6a68b268684f0f2a1a39da308e8a8c630f51 /examples/scxml/trafficlight-qml-simple/Light.qml
parent71087745a8b34e1d73139df63fbfb9f1bb6b9fcd (diff)
Provide a simplified traffic light example
The traffic light QML examples are very large for the simple task they perform. Of course we want nicely designed examples that follow all the patterns we recommend for writing QML. However, we also want to show the simplest way to bind states to QML properties. This is why we need a simplified example in addition to the others. Change-Id: I37022db162353c9bac4bfd775571d4afb666b357 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'examples/scxml/trafficlight-qml-simple/Light.qml')
-rw-r--r--examples/scxml/trafficlight-qml-simple/Light.qml65
1 files changed, 65 insertions, 0 deletions
diff --git a/examples/scxml/trafficlight-qml-simple/Light.qml b/examples/scxml/trafficlight-qml-simple/Light.qml
new file mode 100644
index 0000000..8502d35
--- /dev/null
+++ b/examples/scxml/trafficlight-qml-simple/Light.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtScxml 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.5
+
+Item {
+ property color color
+ height: parent.height / 3
+ width: height
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 3
+ color: parent.color
+ radius: width
+ }
+}
+