Limit profile name to 70% of available width for CustomPrintSetup

This leaves 30% for the variant detail info

CURA-6862
This commit is contained in:
Nino van Hooff 2019-10-14 11:04:28 +02:00
parent c8d65e86f1
commit c147174668

View File

@ -4,6 +4,7 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls 1.4 as OldControls import QtQuick.Controls 1.4 as OldControls
import QtQuick.Layouts 1.3
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.6 as Cura import Cura 1.6 as Cura
@ -66,7 +67,6 @@ Item
{ {
id: intentSelection id: intentSelection
onClicked: menu.opened ? menu.close() : menu.open() onClicked: menu.opened ? menu.close() : menu.open()
text: generateActiveQualityText()
anchors.right: parent.right anchors.right: parent.right
width: UM.Theme.getSize("print_setup_big_item").width width: UM.Theme.getSize("print_setup_big_item").width
@ -75,33 +75,53 @@ Item
baselineOffset: null // If we don't do this, there is a binding loop. WHich is a bit weird, since we override the contentItem anyway... baselineOffset: null // If we don't do this, there is a binding loop. WHich is a bit weird, since we override the contentItem anyway...
contentItem: Label
contentItem: RowLayout
{
spacing: 0
anchors.left: parent.left
anchors.right: customisedSettings.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
Label
{ {
id: textLabel id: textLabel
text: intentSelection.text text: qualityName()
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: intentSelection.verticalCenter anchors.verticalCenter: intentSelection.verticalCenter
Layout.margins: 0
Layout.maximumWidth: parent.width * 0.7
height: contentHeight height: contentHeight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering renderType: Text.NativeRendering
elide: Text.ElideRight
function qualityName() {
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
return resultMap["main"]
}
} }
background: Rectangle Label
{ {
id: backgroundItem text: activeQualityDetailText()
border.color: intentSelection.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") font: UM.Theme.getFont("default")
border.width: UM.Theme.getSize("default_lining").width color: UM.Theme.getColor("text_detail")
radius: UM.Theme.getSize("default_radius").width anchors.verticalCenter: intentSelection.verticalCenter
color: UM.Theme.getColor("main_background") Layout.margins: 0
} Layout.fillWidth: true
function generateActiveQualityText() height: contentHeight
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
elide: Text.ElideRight
function activeQualityDetailText()
{ {
var resultMap = Cura.MachineManager.activeQualityDisplayNameMap var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
var resultMain = resultMap["main"]
var resultSuffix = resultMap["suffix"] var resultSuffix = resultMap["suffix"]
var result = "" var result = ""
@ -114,24 +134,36 @@ Item
{ {
if (Cura.MachineManager.activeQualityLayerHeight > 0) if (Cura.MachineManager.activeQualityLayerHeight > 0)
{ {
result = resultMain
if (resultSuffix) if (resultSuffix)
{ {
result += " - " result += " - "
} }
result += "<font color=\"" + UM.Theme.getColor("text_detail") + "\">"
if (resultSuffix) if (resultSuffix)
{ {
result += resultSuffix result += resultSuffix
} }
result += " - " result += " - "
result += Cura.MachineManager.activeQualityLayerHeight + "mm" result += Cura.MachineManager.activeQualityLayerHeight + "mm"
result += "</font>"
} }
} }
return result return result
} }
}
}
background: Rectangle
{
id: backgroundItem
border.color: intentSelection.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
border.width: UM.Theme.getSize("default_lining").width
radius: UM.Theme.getSize("default_radius").width
color: UM.Theme.getColor("main_background")
}
UM.SimpleButton UM.SimpleButton
{ {