Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.12
- import QtQuick.Controls 2.5
- import QtQuick.Controls.impl 2.5
- import QtGraphicalEffects 1.0
- Rectangle {
- id: root
- anchors.fill: parent
- color: "black"
- property var unfinishedPrintJob : ([])
- Button {
- width: 100
- height: 50
- onClicked: {
- getUnfinishedPrintJob();
- }
- }
- Button {
- y:80
- width: 100
- height: 50
- onClicked: {
- pushUnfinishedPrintJob(3, 999, true);
- }
- }
- function getUnfinishedPrintJob () {
- let i;
- for (i=0; i<10; i++) {
- unfinishedPrintJob.push({
- id: i, //jobName
- cycle: i*2, //
- done: false
- });
- //console.log(unfinishedPrintJob[i]);
- //console.log('test');
- }
- console.log(JSON.stringify(unfinishedPrintJob) );
- }
- function pushUnfinishedPrintJob (jobId, jobCycle, jobDone) {
- var newJob = {
- id: jobId, //jobName
- cycle: jobCycle, //
- done: jobDone
- }
- getUnfinishedPrintJob();
- if (unfinishedPrintJob == undefined)
- unfinishedPrintJob = [];
- //if ( (returnedItem = (order.returned).find(item => item.idPos == idx ))
- var unfinishedIndex;
- if ( unfinishedIndex = unfinishedPrintJob.findIndex(item => item.id == jobId)) {
- unfinishedPrintJob.splice(unfinishedIndex, 1, newJob);
- // if (unfinishedPrintJob) {
- // for (var item in unfinishedPrintJob) {
- // }
- } else {
- unfinishedPrintJob = [];
- unfinishedPrintJob.push(newJob);
- }
- //setUnfinishedPrintJob();
- console.log('' );
- console.log(JSON.stringify(unfinishedPrintJob) );
- console.log('------------------' );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement