123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- import QtQuick 2.11
- Item {
- id:root
- Loader{
- id:loader
- x:100
- y:100
- }
- function show(axisxMin,axisxMax,axisyMin,axisyMax,modelData,title,name){
- loader.sourceComponent = undefined
- loader.sourceComponent = componet
- loader.item.axisxMin = axisxMin
- if(axisxMax > 1)
- loader.item.axisxMax = axisxMax-1
- else
- loader.item.axisxMax = axisxMax
- loader.item.axisyMin = axisyMin
- loader.item.axisyMax = axisyMax
- loader.item.setData(modelData)
- loader.item.title = title
- loader.item.name = name
- }
- function exit(){
- loader.sourceComponent =undefined
- }
- Component{
- id:componet
- Item {
- id:item
- width: 800
- height: 500
- property alias axisxMin : curveDisplay.axisxMin
- property alias axisxMax : curveDisplay.axisxMax
- property alias axisyMin : curveDisplay.axisyMin
- property alias axisyMax : curveDisplay.axisyMax
- property alias title: titleText.text
- property alias name :curveDisplay.name
- property var modelData
- function setData(modelData){
- var pointList=[]
- for(var i=0; i<modelData.count;i++){
- var obj = modelData.get(i)
- var point = Qt.point(i, obj.pressure)
- pointList.push(point)
- }
- dataSource.update(curveDisplay.charView.series(0),pointList)
- // timer.start()
- }
- // Timer{
- // id:timer
- // repeat: false
- // interval: 100
- // onTriggered: {
- // curveDisplayItem.grabToImage(function(result) {
- // result.saveToFile(titleText.text+".jpg");
- // });
- // }
- // }
- Rectangle{
- id:body
- anchors.fill: parent
- border.color: "black"
- border.width: 1
- Rectangle{
- id:title
- x:1
- y:1
- width: parent.width-2
- height: 30
- color: "#DDDDDD"
- Text {
- id: titleText
- text: qsTr("压力记录表")
- anchors.centerIn: parent
- font.bold: true
- font.pixelSize: 13
- }
- Image {
- width: 30
- height: 30
- source: "qrc:/img/close.png"
- anchors.right: parent.right
- MouseArea{
- anchors.fill: parent
- onClicked: {
- root.exit()
- }
- }
- }
- MouseArea{
- anchors.fill: parent
- drag.target: item
- drag.axis: Drag.XAndYAxis
- propagateComposedEvents:true
- }
- }
- Rectangle {
- id:curveDisplayItem
- anchors.top: title.bottom
- x:1
- width: parent.width-2
- height: parent.height-title.height-2
- color: "white"
- CurveDisplay{
- id:curveDisplay
- anchors.verticalCenter: parent.verticalCenter
- width: parent.width//-20
- height: parent.height//-50
- }
- }
- }
- }
- }
- }
|