import QtQuick import QtQuick.Controls import QtQuick.Dialogs import "./common" Item{ property var deviceInfos: [] property var devModel: ListModel{} property var interfaceModel: ListModel{} property bool initialized: false Component.onCompleted: { initJsonModel(tempAModel, "tempAModel.json") initialized = true } Item{ id: tdItem width: parent.width y: -21 height: 50 Column{ anchors.fill: parent spacing: 12 Rectangle{ width: 95 height: 32 radius: 6 color: "#007EFF" Row{ anchors.centerIn: parent spacing: 4 Image { width: 14 height: 14 source: "./resource/import.png" } QxText{ text:"导入模型" font.pixelSize: 14 color: "#FFFFFF" } } MouseArea{ anchors.fill: parent onClicked: { fileADialog.visible = true } } } } } Item{ anchors.top: tdItem.bottom width: parent.width/2 anchors.bottom: parent.bottom Column{ anchors.fill: parent spacing: 12 Column{ spacing: 20 Item{ height: 16 width: parent.width Rectangle{ width: 3 height:16 color: "#007EFF" } QxText{ x: 6 text: "温度阶梯" font.bold: true font.pixelSize: 18 anchors.verticalCenter: parent.verticalCenter } } Row{ spacing: 29 Button{ icon.source: "./resource/add.png" width: 101 height: 32 onClicked: { tempAModel.append({"temperature":"0"}) updateJsonFile(tempAModel, "tempAModel.json") } } Button{ icon.source: "./resource/del.png" width: 101 height: 32 onClicked: { if(tempAModel.count > 1 && tempListView.currentIndex > -1){ tempAModel.remove(tempListView.currentIndex) updateJsonFile(tempAModel, "tempAModel.json") } } } } } Item { width: parent.width height: 629 clip: true ListView{ id: tempListView model: tempAModel anchors.fill: parent header: table_temp_header boundsBehavior: Flickable.StopAtBounds delegate: table_temp_delegate } } } } ListModel{ id: zxModel ListElement{name: "X"} ListElement{name: "Y"} ListElement{name: "Z"} } Component { id: table_temp_header Rectangle { width: parent ? parent.width : 0 height: 40 color: "#F7F7F7" z:2 Row { width: parent.width height: parent.height property var childcount: 2 QxHLabel { text: "序号" } QxHLabel { text: "目标温度/℃" } } } } Component { id: table_temp_delegate Rectangle { width: parent ? parent.width : 0 height: 58 color: tempListView.currentIndex == index ? "#beebff" : ( index % 2 == 0 ? "#F8FAFF" : "#FFFFFF") z:2 Row { width: parent.width height: parent.height property var childcount: 2 QxLabel { text: index+1 } QxLabel { text: temperature editMode: true onValueChanged: { if(temperature != value) { temperature = value updateJsonFile(tempAModel, "tempAModel.json") } } } } MouseArea{ anchors.fill: parent onPressed:(mouse)=> { tempListView.currentIndex = index mouse.accepted = false } } } } }