Warning, /education/kstars/kstars/kstarslite/qml/indi/modules/KSINDITextField.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.Layouts 1.2 0006 import QtQuick.Controls 2.0 0007 0008 import "../../constants" 1.0 0009 import "../../modules" 0010 0011 0012 Flow { 0013 id: textRow 0014 spacing: 5 * Num.dp 0015 anchors { 0016 left: parent.left 0017 right: parent.right 0018 } 0019 0020 property Item textField: field 0021 property bool isNumber: true // false - text, true - number 0022 0023 property string deviceName 0024 property string propName 0025 property string fieldName 0026 0027 KSTextField { 0028 id: field 0029 } 0030 0031 Button { 0032 text: xi18n("Set") 0033 onClicked: { 0034 if(isNumber) { 0035 ClientManagerLite.sendNewINDINumber(deviceName, propName, fieldName, field.text) 0036 } else { 0037 ClientManagerLite.sendNewINDIText(deviceName, propName, fieldName, field.text) 0038 } 0039 Qt.inputMethod.hide() 0040 } 0041 } 0042 0043 Connections { 0044 target: ClientManagerLite 0045 onNewINDINumber: { 0046 if(isNumber) { 0047 if(textRow.deviceName == deviceName) { 0048 if(textRow.propName == propName) { 0049 if(textRow.fieldName == numberName) { 0050 field.text = value 0051 } 0052 } 0053 } 0054 } 0055 } 0056 onNewINDIText: { 0057 if(!isNumber) { 0058 if(textRow.deviceName == deviceName) { 0059 if(textRow.propName == propName) { 0060 if(textRow.fieldName == fieldName) { 0061 field.text = text 0062 } 0063 } 0064 } 0065 } 0066 } 0067 } 0068 }