mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 17:49:01 +08:00
MaterialInfo: Also replace HTML-text with QML-elements for 'by line-type'. [CURA-6141]
This commit is contained in:
parent
7fdbb11f49
commit
e7ff70870f
@ -36,30 +36,60 @@ Column
|
|||||||
|
|
||||||
Label
|
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
|
// All the time information for the different features is achieved
|
||||||
var printTime = PrintInformation.getFeaturePrintTimes()
|
var printTime = PrintInformation.getFeaturePrintTimes()
|
||||||
var totalSeconds = parseInt(printDuration.getDisplayString(UM.DurationFormat.Seconds))
|
var totalSeconds = parseInt(printDuration.getDisplayString(UM.DurationFormat.Seconds))
|
||||||
|
|
||||||
// A message is created and displayed when the user hover the time label
|
// A message is created and displayed when the user hover the time label
|
||||||
var text = "<table width=\"100%\">"
|
|
||||||
for(var feature in printTime)
|
for(var feature in printTime)
|
||||||
{
|
{
|
||||||
if(!printTime[feature].isTotalDurationZero)
|
if(!printTime[feature].isTotalDurationZero)
|
||||||
{
|
{
|
||||||
text += "<tr><td>" + feature + ":</td>" +
|
var row = []
|
||||||
"<td align=\"right\" valign=\"bottom\"> %1</td>".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) +
|
row.push(feature + ":")
|
||||||
"<td align=\"right\" valign=\"bottom\"> %1%</td>".arg(Math.round(100 * parseInt(printTime[feature].getDisplayString(UM.DurationFormat.Seconds)) / totalSeconds)) +
|
row.push("%1".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)))
|
||||||
"</tr>"
|
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
|
width: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
||||||
|
height: childrenRect.height
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
Loading…
x
Reference in New Issue
Block a user