diff options
author | Remco Burema <r.burema@ultimaker.com> | 2019-01-26 13:25:38 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2019-01-26 13:25:38 +0300 |
commit | e7ff70870f046df820c676791aec4aecc6daf78e (patch) | |
tree | e2185ed63e3e8234547baf2e5eb3a5563d27f85f /resources/qml/ActionPanel | |
parent | 7fdbb11f492e00ec75dfcf8037a00aad75b94799 (diff) |
MaterialInfo: Also replace HTML-text with QML-elements for 'by line-type'. [CURA-6141]
Diffstat (limited to 'resources/qml/ActionPanel')
-rw-r--r-- | resources/qml/ActionPanel/PrintJobInformation.qml | 46 |
1 files changed, 38 insertions, 8 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 { + id: byLineType + property var printDuration: PrintInformation.currentPrintTime + property var columnWidthMultipliers: [ 0.4, 0.3, 0.3 ] - text: + 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 = "<table width=\"100%\">" for(var feature in printTime) { if(!printTime[feature].isTotalDurationZero) { - text += "<tr><td>" + feature + ":</td>" + - "<td align=\"right\" valign=\"bottom\"> %1</td>".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) + - "<td align=\"right\" valign=\"bottom\"> %1%</td>".arg(Math.round(100 * parseInt(printTime[feature].getDisplayString(UM.DurationFormat.Seconds)) / totalSeconds)) + - "</tr>" + 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 += "</table>" - 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 |