mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 03:03:35 +02:00
Adding a true ListView for the engine
This commit is contained in:
parent
652c754373
commit
f08f77098d
5 changed files with 83 additions and 4 deletions
|
@ -45,6 +45,15 @@ function job_propKeys(job) {
|
||||||
return propKeys;
|
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
|
// 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) {
|
function job_print_functor(printout, showProps, maxDepth) {
|
||||||
if (maxDepth === undefined) maxDepth = 100
|
if (maxDepth === undefined) maxDepth = 100
|
||||||
|
|
|
@ -17,7 +17,9 @@ import "qrc:///qml/controls-uit" as HifiControls
|
||||||
|
|
||||||
import "../jet.js" as Jet
|
import "../jet.js" as Jet
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
HifiConstants { id: hifi;}
|
||||||
|
color: hifi.colors.baseGray;
|
||||||
id: root
|
id: root
|
||||||
// width: parent ? parent.width : 200
|
// width: parent ? parent.width : 200
|
||||||
// height: parent ? parent.height : 400
|
// height: parent ? parent.height : 400
|
||||||
|
|
67
scripts/developer/utilities/lib/jet/qml/TaskListView.qml
Normal file
67
scripts/developer/utilities/lib/jet/qml/TaskListView.qml
Normal 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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
TaskList 1.0 TaskList.qml
|
TaskList 1.0 TaskList.qml
|
||||||
|
TaskViewList 1.0 TaskViewList.qml
|
|
@ -20,10 +20,10 @@ Item {
|
||||||
HifiConstants { id: hifi;}
|
HifiConstants { id: hifi;}
|
||||||
id: render;
|
id: render;
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
property var mainViewTask: Render.getConfig("RenderMainView")
|
property var mainViewTask: Render.getConfig("RenderMainView")
|
||||||
|
|
||||||
Jet.TaskList {
|
Jet.TaskListView {
|
||||||
rootConfig: Render
|
rootConfig: Render
|
||||||
anchors.fill: render
|
anchors.fill: render
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue