Warning, /education/kstars/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtQuick 2.6 0005 import QtQuick.Controls 1.4 0006 import QtQuick.Window 2.2 0007 import "../../constants" 1.0 0008 import QtQuick.Layouts 1.2 0009 0010 Flow { 0011 id:buttonsRow 0012 property bool checkBox: false 0013 property string propName: "" 0014 property string deviceName: "" 0015 property bool exclusive: false 0016 Layout.fillWidth: true 0017 spacing: 10 * Num.dp 0018 0019 Connections { 0020 target: ClientManagerLite 0021 onNewINDISwitch: { 0022 if(buttonsRow.deviceName == deviceName) { 0023 if(buttonsRow.propName == propName) { 0024 for(var i = 0; i < children.length; ++i) { 0025 if(children[i].switchName == switchName) { 0026 children[i].checked = isOn 0027 } 0028 } 0029 } 0030 } 0031 } 0032 } 0033 0034 function addButton(propText, switchName, initChecked, enabled) { 0035 var buttonComp = Qt.createComponent("KSButtonSwitch.qml"); 0036 var button = buttonComp.createObject(this) 0037 button.text = propText 0038 button.switchName = switchName 0039 button.parentRow = this 0040 button.checked = initChecked 0041 button.enabled = enabled 0042 } 0043 0044 function addCheckBox(propText, switchName, initChecked, enabled) { 0045 var checkBoxComp = Qt.createComponent("KSCheckBox.qml"); 0046 var checkBox = checkBoxComp.createObject(this) 0047 checkBox.text = propText 0048 checkBox.switchName = switchName 0049 checkBox.parentRow = this 0050 checkBox.checked = initChecked 0051 checkBox.enabled = enabled 0052 } 0053 0054 function sendNewProperty(switchName, button) { 0055 ClientManagerLite.sendNewINDISwitch(deviceName,propName,switchName) 0056 if(exclusive && button != null) { 0057 for(var i = 0; i < children.length; ++i) { 0058 if(children[i] !== button) { 0059 children[i].checked = false 0060 } 0061 } 0062 } 0063 } 0064 } 0065