1 Star 0 Fork 0

AdrianW / SDMonitor_GUI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
DevRecordPage.qml 3.90 KB
一键复制 编辑 原始数据 按行查看 历史
AdrianW 提交于 2018-07-27 09:56 . Init Files
import QtQuick 2.0
import QtQuick.Controls 2.2
Item {
id:sdlogpage
width: 400
height: 400
property ListModel sdOnlineModel: ListModel{}
property ListModel sdOfflineModel: ListModel{}
property ListModel sdEmgModel: ListModel{
// ListElement{
// errorDevType:7
// errorStr:"Open"
// errorAddr:"Test Addr "
// datetime: new Date().toLocaleString(Qt.locale() , "yyyy-MM-dd hh:mm:ss")
// }
// ListElement{
// errorDevType:1
// errorStr:"Open"
// errorAddr:"Test Addr "
// datetime: new Date().toLocaleString(Qt.locale() , "yyyy-MM-dd hh:mm:ss")
// }
}
function sdEvent(error , addr , devType , type){
var model = sdOnlineModel
// switch(type){
// case "Online":
// model = sdOnlineModel
// break
// case "Offline":
// model = sdOfflineModel
// break
// case "Emg":
// model = sdEmgModel
// break
// default:
// return
// }
model.insert(0 , {"errorDevType":devType ,
"errorStr":error ,
"errorAddr":addr ,
"datetime":new Date().toLocaleString(Qt.locale() , "yyyy-MM-dd hh:mm:ss")
})
}
PieChartView{
id:devpiechart
width: parent.width
height: parent.height*0.5
}
Timer{
id:checSDWorkState
interval: 5000
repeat: true
running: true
onTriggered: {
var emgcnt , offlinecnt , onlinecnt
var cntinfo = SDController.getSDSateInfo()
console.log(cntinfo.split("*"))
emgcnt = parseInt(cntinfo.split("*")[0])
offlinecnt = parseInt(cntinfo.split("*")[1])
onlinecnt = parseInt(cntinfo.split("*")[2])
devpiechart.setDevCntInfo(emgcnt , offlinecnt , onlinecnt)
}
}
ListView {
id: sdOnlinelistView
width: parent.width
height: parent.height*0.5-40
anchors.left: parent.left
anchors.leftMargin: 0
anchors.top: devpiechart.bottom
anchors.topMargin: 0
clip: true
delegate: logdelegate
model: sdOnlineModel
Rectangle{anchors.fill: parent ; color: "#55fc51" ; opacity: 0.7; z:-1}
}
Button{
id:clearRecord
text: "清除记录"
anchors.top: sdOnlinelistView.bottom
anchors.left: parent.left
anchors.leftMargin: 0
onClicked: {
sdOnlineModel.clear()
}
}
Component{
id:logdelegate
Item {
width: parent.width
height: 40
Rectangle {
id: rectangle
color: Qt.rgba(1,1,1,0.5)
anchors.fill: parent
radius: 5
Text {
id: txtErrorTime
x: 16
y: 10
width: 203
height: 40
text: datetime
font.pixelSize: 22
}
Text {
id: txtErrorDevType
x: 260
y: 10
width: 184
height: 40
text: "设备类型:" + errorDevType
font.pixelSize: 22
}
Text {
id: text1
x: 600
y: 0
width: 800
height: 40
text: errorAddr+" "+errorStr
verticalAlignment: Text.AlignVCenter
clip: true
wrapMode: Text.WordWrap
// horizontalAlignment: Text.AlignHCenter
font.pixelSize: 30
}
}
}
}
}
1
https://gitee.com/adrianW/SDMonitor_GUI.git
git@gitee.com:adrianW/SDMonitor_GUI.git
adrianW
SDMonitor_GUI
SDMonitor_GUI
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891