Adding a true ListView for the engine

This commit is contained in:
samcake 2018-05-09 18:28:47 -07:00
parent 652c754373
commit f08f77098d
5 changed files with 83 additions and 4 deletions

View file

@ -45,6 +45,15 @@ function job_propKeys(job) {
return propKeys;
}
// Use this function to create a functor that will fill the specifed array with one entry name per task and job and it s rank
function job_list_functor(jobList, maxDepth) {
if (maxDepth === undefined) maxDepth = 100
return function (job, depth, index) {
jobList.push(job.objectName);
return depth < maxDepth;
}
}
// Use this function to create a functor that will print the content of the Job visited calling the specified 'printout' function
function job_print_functor(printout, showProps, maxDepth) {
if (maxDepth === undefined) maxDepth = 100

View file

@ -17,7 +17,9 @@ import "qrc:///qml/controls-uit" as HifiControls
import "../jet.js" as Jet
Rectangle {
Rectangle {
HifiConstants { id: hifi;}
color: hifi.colors.baseGray;
id: root
// width: parent ? parent.width : 200
// height: parent ? parent.height : 400

View file

@ -0,0 +1,67 @@
//
// jet/TaskListView.qml
//
// Created by Sam Gateau, 2018/05/09
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.7
import QtQuick.Controls 1.4 as Original
import QtQuick.Controls.Styles 1.4
import "qrc:///qml/styles-uit"
import "qrc:///qml/controls-uit" as HifiControls
import "../jet.js" as Jet
Rectangle {
HifiConstants { id: hifi;}
color: hifi.colors.baseGray;
id: root
// width: parent ? parent.width : 200
// height: parent ? parent.height : 400
property var rootConfig : Workload
property var myArray : []
Component.onCompleted: {
var message = ""
var functor = Jet.job_print_functor(function (line) { message += line + "\n"; }, false);
functor = Jet.job_list_functor(root.myArray);
Jet.task_traverseTree(rootConfig, functor);
//print(JSON.stringify(root.myArray))
// theView.model = root.myArray.length
for (var i = 0; i < root.myArray.length; i++) {
jobsModel.append({"on": true, "name": root.myArray[i]})
}
// theView.model = root.myArray
}
function getJobName(i) {
return root.myArray[i];
}
ListModel {
id: jobsModel
}
Component {
id: itemDelegate
//HifiControls.Label { text: "I am item number: " + index }
HifiControls.CheckBox { text: name + index;
checked: true; }
}
ListView {
id: theView
anchors.fill: parent
model: jobsModel
delegate: itemDelegate
}
}

View file

@ -1 +1,2 @@
TaskList 1.0 TaskList.qml
TaskList 1.0 TaskList.qml
TaskViewList 1.0 TaskViewList.qml

View file

@ -20,10 +20,10 @@ Item {
HifiConstants { id: hifi;}
id: render;
anchors.fill: parent
property var mainViewTask: Render.getConfig("RenderMainView")
Jet.TaskList {
Jet.TaskListView {
rootConfig: Render
anchors.fill: render
}