Split of getStringParts function

Spit into `getMainStringParts` and `getTailStringParts` so we can easily differentiate between the two in the front-end.

Cura-9773
This commit is contained in:
c.lamboo 2022-11-28 13:10:52 +01:00
parent 5ed572779d
commit 8e8437eab0
3 changed files with 40 additions and 8 deletions

View file

@ -67,7 +67,7 @@ Item
UM.Label
{
id: textLabel
text: Cura.MachineManager.activeQualityDisplayNameStringParts[0]
text: Cura.MachineManager.activeQualityDisplayNameMainStringParts.join(" - ")
Layout.margins: 0
Layout.maximumWidth: Math.floor(parent.width * 0.7) // Always leave >= 30% for the rest of the row.
height: contentHeight
@ -77,7 +77,18 @@ Item
UM.Label
{
text: ` - ${Cura.MachineManager.activeQualityDisplayNameStringParts.slice(1).join(" - ")}`
text:
{
const string_parts = Cura.MachineManager.activeQualityDisplayNameTailStringParts;
if (string_parts.length === 0)
{
return "";
}
else
{
` - ${string_parts.join(" - ")}`
}
}
color: UM.Theme.getColor("text_detail")
Layout.margins: 0