From 200e4df0254a5a3f4907331da6ee82a3030ba575 Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 26 Jan 2022 10:25:20 +0100 Subject: 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 --- .../SimulationView/SimulationViewMenuComponent.qml | 57 ++++++++++------------ 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'plugins/SimulationView') diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index e40f7d0e4b..0a5065abf0 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -93,7 +93,8 @@ Cura.ExpandableComponent spacing: UM.Theme.getSize("layerview_row_spacing").height - ListModel // matches SimulationView.py + // matches SimulationView.py + ListModel { id: layerViewTypes } @@ -129,6 +130,8 @@ Cura.ExpandableComponent ComboBox { id: layerTypeCombobox + textRole: "text" + valueRole: "type_id" width: parent.width model: layerViewTypes visible: !UM.SimulationView.compatibilityMode @@ -146,39 +149,33 @@ Cura.ExpandableComponent radius: UM.Theme.getSize("setting_control_radius").width } - contentItem: Item + indicator: UM.RecolorImage { - Label - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_lining").width - anchors.right: downArrow.left - anchors.rightMargin: UM.Theme.getSize("default_lining").width - anchors.verticalCenter: parent.verticalCenter + id: downArrow + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 + anchors.verticalCenter: parent.verticalCenter - text: ladyerTypeCombobox.currentText - font: UM.Theme.getFont("default"); - color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") + source: UM.Theme.getIcon("ChevronSingleDown") + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + 5 * screenScaleFactor + sourceSize.height: width + 5 * screenScaleFactor - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - - UM.RecolorImage - { - id: downArrow - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 - anchors.verticalCenter: parent.verticalCenter - - source: UM.Theme.getIcon("ChevronSingleDown") - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width + 5 * screenScaleFactor - sourceSize.height: width + 5 * screenScaleFactor + color: UM.Theme.getColor("setting_control_button"); + } - color: UM.Theme.getColor("setting_control_button"); - } + contentItem: UM.Label + { + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_lining").width + anchors.right: downArrow.left + anchors.rightMargin: UM.Theme.getSize("default_lining").width + anchors.verticalCenter: parent.verticalCenter + + text: layerTypeCombobox.currentText + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter } onActivated: -- cgit v1.2.3