//create instance of c++ class
CrcDataQML2{
id: crcClassInstance
}
//create List Model
ListModel{
id: crcPointListModel
}
function setIndividualValue(columnToSet, IndexToSet, valueToSet)
{
crcClassInstance.setDataQML(columnToSet, IndexToSet, valueToSet);
}
//function to populate values in ListModel
function getDataValues(id)
{
var i;
var j;
var k;
console.log()
for (i = 0; i<23; i++ )
{
id.set(i,{ "setPoint":crcClassInstance.getDataQML(Global.POINT_SET_POINT,i),
"currentValue":crcClassInstance.getDataQML(Global.POINT_CURRENT_VALUE,i),
"engineeringUnits":crcClassInstance.getDataQML(Global.POINT_ENGINEERING_UNITS,i),
"resolution":crcClassInstance.getDataQML(Global.POINT_RESOLUTION,i),
name:crcClassInstance.getQMLDataString(Global.POINT_NAME,i),
"currentValueSource":crcClassInstance.getDataQML(Global.POINT_CV_ORIGIN,i),
"setPointSource":crcClassInstance.getDataQML(Global.POINT_SP_ORIGIN,i),
"alarmHigh":crcClassInstance.getDataQML(Global.POINT_ALARM_OVER,i),
"alarmLow":crcClassInstance.getDataQML(Global.POINT_ALARM_UNDER,i),
"alarmStatus":crcClassInstance.getDataQML(Global.POINT_ALARM_STATUS,i),
"displayPoint":crcClassInstance.getBoolDataQML(Global.POINT_DISPLAY,i),
"setPointDisplay":false,
"alarmSetup":3,
"currentValueOffset":crcClassInstance.getDataQML(Global.POINT_CURRENT_VALUE_OFFSET,i)
});
}
}
Timer{
id: timerSam
running: true
repeat: true
triggeredOnStart: true
interval: 1000
onTriggered: {
//updates values in c++
//getDataValues(crcPointListModel);
testRowInsertion(crcPointListModel,"name");
//sets a value in c++ equal to the current secnd value - just to prove we are able to manipulate values in c++
setIndividualValue(Global.POINT_CURRENT_VALUE, 0, parseInt(Qt.formatTime(new Date(),"ss")) );
}
}
//create instance of c++ class
CrcDataQML2{
id: crcClassInstance
}
//create List Model
ListModel{
id: crcPointListModel
}
function setIndividualValue(columnToSet, IndexToSet, valueToSet)
{
crcClassInstance.setDataQML(columnToSet, IndexToSet, valueToSet);
}
//function to populate values in ListModel
function getDataValues(id)
{
var i;
var j;
var k;
console.log()
for (i = 0; i<23; i++ )
{
id.set(i,{ "setPoint":crcClassInstance.getDataQML(Global.POINT_SET_POINT,i),
"currentValue":crcClassInstance.getDataQML(Global.POINT_CURRENT_VALUE,i),
"engineeringUnits":crcClassInstance.getDataQML(Global.POINT_ENGINEERING_UNITS,i),
"resolution":crcClassInstance.getDataQML(Global.POINT_RESOLUTION,i),
name:crcClassInstance.getQMLDataString(Global.POINT_NAME,i),
"currentValueSource":crcClassInstance.getDataQML(Global.POINT_CV_ORIGIN,i),
"setPointSource":crcClassInstance.getDataQML(Global.POINT_SP_ORIGIN,i),
"alarmHigh":crcClassInstance.getDataQML(Global.POINT_ALARM_OVER,i),
"alarmLow":crcClassInstance.getDataQML(Global.POINT_ALARM_UNDER,i),
"alarmStatus":crcClassInstance.getDataQML(Global.POINT_ALARM_STATUS,i),
"displayPoint":crcClassInstance.getBoolDataQML(Global.POINT_DISPLAY,i),
"setPointDisplay":false,
"alarmSetup":3,
"currentValueOffset":crcClassInstance.getDataQML(Global.POINT_CURRENT_VALUE_OFFSET,i)
});
}
}
Timer{
id: timerSam
running: true
repeat: true
triggeredOnStart: true
interval: 1000
onTriggered: {
//updates values in c++
//getDataValues(crcPointListModel);
testRowInsertion(crcPointListModel,"name");
//sets a value in c++ equal to the current secnd value - just to prove we are able to manipulate values in c++
setIndividualValue(Global.POINT_CURRENT_VALUE, 0, parseInt(Qt.formatTime(new Date(),"ss")) );
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks