Fix issues in simulation view

- Correctly display text in LayerType dropdown menu
- Use UM.Label component to reduce code duplication
- Don't display QtControls default dropdown icon

CURA-8684
This commit is contained in:
casper 2022-01-26 10:25:20 +01:00
parent b51c787f62
commit 200e4df025

View file

@ -93,7 +93,8 @@ Cura.ExpandableComponent
spacing: UM.Theme.getSize("layerview_row_spacing").height spacing: UM.Theme.getSize("layerview_row_spacing").height
ListModel // matches SimulationView.py // matches SimulationView.py
ListModel
{ {
id: layerViewTypes id: layerViewTypes
} }
@ -129,6 +130,8 @@ Cura.ExpandableComponent
ComboBox ComboBox
{ {
id: layerTypeCombobox id: layerTypeCombobox
textRole: "text"
valueRole: "type_id"
width: parent.width width: parent.width
model: layerViewTypes model: layerViewTypes
visible: !UM.SimulationView.compatibilityMode visible: !UM.SimulationView.compatibilityMode
@ -146,39 +149,33 @@ Cura.ExpandableComponent
radius: UM.Theme.getSize("setting_control_radius").width radius: UM.Theme.getSize("setting_control_radius").width
} }
contentItem: Item indicator: UM.RecolorImage
{ {
Label id: downArrow
{ anchors.right: parent.right
anchors.left: parent.left anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
anchors.leftMargin: UM.Theme.getSize("default_lining").width anchors.verticalCenter: parent.verticalCenter
anchors.right: downArrow.left
anchors.rightMargin: UM.Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter
text: ladyerTypeCombobox.currentText source: UM.Theme.getIcon("ChevronSingleDown")
font: UM.Theme.getFont("default"); width: UM.Theme.getSize("standard_arrow").width
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
elide: Text.ElideRight color: UM.Theme.getColor("setting_control_button");
verticalAlignment: Text.AlignVCenter }
}
UM.RecolorImage contentItem: UM.Label
{ {
id: downArrow anchors.left: parent.left
anchors.right: parent.right anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 anchors.right: downArrow.left
anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: UM.Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter
source: UM.Theme.getIcon("ChevronSingleDown") text: layerTypeCombobox.currentText
width: UM.Theme.getSize("standard_arrow").width elide: Text.ElideRight
height: UM.Theme.getSize("standard_arrow").height verticalAlignment: Text.AlignVCenter
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_button");
}
} }
onActivated: onActivated: