Warning, /sdk/cutehmi/extensions/CuteHMI/Symbols/HVAC.1/Valve.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.5 0002 0003 import CuteHMI.GUI 1.0 0004 0005 /** 0006 Valve. 0007 */ 0008 Element { 0009 id: root 0010 0011 implicitWidth: loaderWrapper.childrenRect.width 0012 implicitHeight: loaderWrapper.childrenRect.height 0013 0014 active: true 0015 0016 readonly property real wayWidth: units.quadrat * 0.25 0017 0018 readonly property real wayHeight: units.quadrat * 0.25 0019 0020 property bool leftWay: true 0021 0022 property bool rightWay: true 0023 0024 property bool topWay: false 0025 0026 property bool bottomWay: false 0027 0028 property bool leftClosed: false 0029 0030 property bool rightClosed: false 0031 0032 property bool topClosed: false 0033 0034 property bool bottomClosed: false 0035 0036 property Component way: Component { 0037 SymbolCanvas { 0038 id: canvas 0039 0040 implicitWidth: root.wayWidth 0041 implicitHeight: root.wayHeight 0042 0043 element: root 0044 0045 onPaint: { 0046 var ctx = getContext('2d') 0047 ctx.save() 0048 ctx.reset() 0049 0050 ctx.strokeStyle = root.color.stroke 0051 if (closed) 0052 ctx.fillStyle = root.color.stroke 0053 else 0054 ctx.fillStyle = root.color.fill 0055 ctx.lineWidth = units.strokeWidth 0056 0057 var offset = units.strokeWidth / 2.0 0058 0059 ctx.moveTo(offset, offset) 0060 ctx.lineTo(width - offset, height * 0.5) 0061 ctx.lineTo(offset, height - offset) 0062 ctx.closePath() 0063 ctx.fill() 0064 ctx.stroke() 0065 0066 ctx.restore() 0067 } 0068 0069 Connections { 0070 target: parent 0071 0072 function onClosedChanged() { 0073 requestPaint() 0074 } 0075 } 0076 } 0077 } 0078 0079 Item { 0080 id: loaderWrapper 0081 0082 Loader { 0083 y: topWay ? 0.5 * height : 0 0084 width: leftWay ? wayWidth : 0 0085 height: leftWay ? wayHeight : 0 0086 sourceComponent: leftWay ? way : undefined 0087 0088 property bool closed: leftClosed 0089 } 0090 0091 Loader { 0092 x: leftWay ? width : (topWay || bottomWay) ? width * 0.5 : 0 0093 y: topWay ? 0.5 * height : 0 0094 width: rightWay ? wayWidth : 0 0095 height: rightWay ? wayHeight : 0 0096 rotation: 180 0097 sourceComponent: rightWay ? way : undefined 0098 0099 property bool closed: rightClosed 0100 } 0101 0102 Loader { 0103 x: leftWay ? width * 0.5 : 0 0104 width: topWay ? wayWidth : 0 0105 height: topWay ? wayHeight : 0 0106 rotation: 90 0107 sourceComponent: topWay ? way : undefined 0108 0109 property bool closed: topClosed 0110 } 0111 0112 Loader { 0113 x: leftWay ? width * 0.5 : 0 0114 y: topWay ? height : (leftWay || rightWay) ? height * 0.5 : 0 0115 width: bottomWay ? wayWidth : 0 0116 height: bottomWay ? wayHeight : 0 0117 rotation: -90 0118 sourceComponent: bottomWay ? way : undefined 0119 0120 property bool closed: bottomClosed 0121 } 0122 } 0123 } 0124 0125 //(c)C: Copyright © 2020-2021, Michał Policht <michal@policht.pl>. All rights reserved. 0126 //(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT 0127 //(c)C: This file is a part of CuteHMI. 0128 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 0129 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 0130 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>. 0131 //(c)C: Additionally, this file is licensed under terms of MIT license as expressed below. 0132 //(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 0133 //(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 0134 //(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.