Index: sources/gui/qml/components/StepIndicator.qml =================================================================== diff -u -rfa1b7c7d5ca98b991168bacc0bab1e9614ed39b6 -r6112c3191d418571246b5b6da11502b2e723ef2e --- sources/gui/qml/components/StepIndicator.qml (.../StepIndicator.qml) (revision fa1b7c7d5ca98b991168bacc0bab1e9614ed39b6) +++ sources/gui/qml/components/StepIndicator.qml (.../StepIndicator.qml) (revision 6112c3191d418571246b5b6da11502b2e723ef2e) @@ -43,23 +43,26 @@ QtObject { id: _private property string stepNamesFirst: "" property var stepNamesRest : [] + function setupModel(names) { + if ( names.length > 1 ) { + for (let i = 0; i < names.length; i++) { + if (i === 0) + stepNamesFirst = names[i] + else + stepNamesRest[i-1] = names[i] + } + } + else { + if (names.length) stepNamesFirst = names[0] + else stepNamesFirst = "" + stepNamesRest = [] + } + console.debug(_root.stepNames, stepNamesFirst, stepNamesRest) + } } onStepNamesChanged: { - console.debug(_root.stepNames) - if ( _root.stepNames.length > 1 ) { - // javascript shift() on array will return the first element - // and will update the original array by removing the first element - // that's why on the stepNamesRest assignment the origianl has been assigned. - let mStepNames = _root.stepNames - _private.stepNamesFirst = mStepNames.shift() - _private.stepNamesRest = mStepNames - } - else { - if (_root.stepNames.length) _private.stepNamesFirst = _root.stepNames[0] - else _private.stepNamesFirst = "" - _private.stepNamesRest = [] - } + _private.setupModel(_root.stepNames) } Grid { id: _gridSteps