From e7ff70870f046df820c676791aec4aecc6daf78e Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Sat, 26 Jan 2019 11:25:38 +0100 Subject: [PATCH] MaterialInfo: Also replace HTML-text with QML-elements for 'by line-type'. [CURA-6141] --- .../qml/ActionPanel/PrintJobInformation.qml | 48 +++++++++++++++---- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/resources/qml/ActionPanel/PrintJobInformation.qml b/resources/qml/ActionPanel/PrintJobInformation.qml index daac6e0a19..50e4343626 100644 --- a/resources/qml/ActionPanel/PrintJobInformation.qml +++ b/resources/qml/ActionPanel/PrintJobInformation.qml @@ -36,30 +36,60 @@ Column Label { - property var printDuration: PrintInformation.currentPrintTime + id: byLineType - text: + property var printDuration: PrintInformation.currentPrintTime + property var columnWidthMultipliers: [ 0.4, 0.3, 0.3 ] + + function getMaterialTable() { + var result = [] + // All the time information for the different features is achieved var printTime = PrintInformation.getFeaturePrintTimes() var totalSeconds = parseInt(printDuration.getDisplayString(UM.DurationFormat.Seconds)) // A message is created and displayed when the user hover the time label - var text = "" for(var feature in printTime) { if(!printTime[feature].isTotalDurationZero) { - text += "" + - "".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) + - "".arg(Math.round(100 * parseInt(printTime[feature].getDisplayString(UM.DurationFormat.Seconds)) / totalSeconds)) + - "" + var row = [] + row.push(feature + ":") + row.push("%1".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3))) + row.push("%1%".arg(Math.round(100 * parseInt(printTime[feature].getDisplayString(UM.DurationFormat.Seconds)) / totalSeconds))) + result.push(row) } } - text += "
" + feature + ":  %1  %1%
" - return text + + return result } + + Column + { + Repeater + { + model: byLineType.getMaterialTable() + Row + { + Repeater + { + model: modelData + Text + { + width: Math.round(byLineType.width * byLineType.columnWidthMultipliers[index]) + height: contentHeight + font: UM.Theme.getFont("default") + wrapMode: Text.WrapAnywhere + text: modelData + } + } + } + } + } + width: parent.width - 2 * UM.Theme.getSize("default_margin").width + height: childrenRect.height color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") renderType: Text.NativeRendering