import QtQuick import QtQuick.Controls import "./common" Item{ property var deviceInfos: [] property var devModel: ListModel{} property var interfaceModel: ListModel{} property bool initialized: false Component.onCompleted: { initJsonModel(hmhzModel, "hmhzModel.json") initialized = true } Item{ y: -19 clip: true width: parent.width height: parent.height ListView{ model: hmhzModel header: table_st_header interactive: false anchors.fill: parent delegate: table_st_delegate } } Component { id: table_st_header Rectangle { width: parent ? parent.width : 0 height: 40 color: "#f0f0f0" z:2 Row { width: parent.width height: parent.height property var childcount: 5 QxHLabel { text: "序号" } QxHLabel { text: "时间/s" } QxHLabel { text: "X轴/nT" } QxHLabel { text: "Y轴/nT" } QxHLabel { text: "Z轴/nT" } } } } Component { id: table_st_delegate Rectangle { width: parent ? parent.width : 0 height: 58 color: index % 2 == 0 ? "#F8FAFF" : "#FFFFFF" z:2 Row { width: parent.width height: parent.height property var childcount: 5 QxLabel { text: index+1 } QxLabel { text: v1 editMode: true onValueChanged: { if (!initialized) return if(v1 != value) { v1 = value updateJsonFile(hmhzModel, "hmhzModel.json") } } } QxLabel { text: v2 editMode: true onValueChanged: { if (!initialized) return if(v2 != value) { v2 = value updateJsonFile(hmhzModel, "hmhzModel.json") } } } QxLabel { text: v3 editMode: true onValueChanged: { if (!initialized) return if(v3 != value) { v3 = value updateJsonFile(hmhzModel, "hmhzModel.json") } } } QxLabel { text: v4 editMode: true onValueChanged: { if (!initialized) return if(v4 != value) { v4 = value updateJsonFile(hmhzModel, "hmhzModel.json") } } } } } } }