From d34c79249b71acfffcd04eb1017a9c2d9438ce26 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 15 Nov 2016 16:40:04 +0100 Subject: [PATCH 1/8] Changed recommended sidebar options, seems to work. CURA-2767 --- resources/qml/SidebarSimple.qml | 218 +++++++++++++++++--------------- 1 file changed, 115 insertions(+), 103 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index e353742c72..c9a7e12d07 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -35,7 +35,7 @@ Item Label{ id: infillLabel //: Infill selection label - text: catalog.i18nc("@label", "Infill:"); + text: catalog.i18nc("@label", "Infill"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); anchors.top: parent.top @@ -209,14 +209,122 @@ Item anchors.right: parent.right height: childrenRect.height + Label{ + id: enableSupportLabel + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: enableSupportCheckBox.verticalCenter + width: parent.width / 100 * 35 - 3 * UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@label", "Enable Support"); + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); + } + + CheckBox{ + id: enableSupportCheckBox + anchors.top: parent.top + anchors.left: enableSupportLabel.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + style: UM.Theme.styles.checkbox; + enabled: base.settingsEnabled + + checked: supportEnabled.properties.value == "True"; + + MouseArea { + id: enableSupportMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: true + onClicked: + { + // The value is a string "True" or "False" + supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True"); + } + onEntered: + { + base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportCheckBox.x, 0), + catalog.i18nc("@label", supportEnabled.properties.description)); + } + onExited: + { + base.hideTooltip(); + } + } + } + + Label{ + id: supportExtruderLabel + visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: supportExtruderCombobox.verticalCenter + width: parent.width / 100 * 35 - 3 * UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@label", "Support Extruder"); + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); + } + + ComboBox { + id: supportExtruderCombobox + visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) + model: extruderModel + + anchors.top: enableSupportCheckBox.bottom + anchors.topMargin: { + if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) { + return UM.Theme.getSize("default_margin").height; + } else { + return 0; + } + } + anchors.left: supportExtruderLabel.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + width: parent.width / 100 * 65 + height: { + if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) { + // default height when control is enabled + return UM.Theme.getSize("setting_control").height; + } else { + return 0; + } + } + + style: UM.Theme.styles.combobox + enabled: base.settingsEnabled + property alias _hovered: supportExtruderMouseArea.containsMouse + + currentIndex: parseFloat(supportExtruderNr.properties.value) // supportEnabled.properties.value == "True" ? parseFloat(supportExtruderNr.properties.value) : -1 + onActivated: { + // Send the extruder nr as a string. + supportExtruderNr.setPropertyValue("value", String(index)); + } + MouseArea { + id: supportExtruderMouseArea + anchors.fill: parent + hoverEnabled: true + enabled: base.settingsEnabled + acceptedButtons: Qt.NoButton + onEntered: + { + base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), + catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); + } + onExited: + { + base.hideTooltip(); + } + } + } + + Label{ id: adhesionHelperLabel anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: adhesionCheckBox.verticalCenter width: parent.width / 100 * 35 - 3 * UM.Theme.getSize("default_margin").width - //: Bed adhesion label - text: catalog.i18nc("@label", "Helper Parts:"); + text: catalog.i18nc("@label", "Build Plate Adhesion"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); } @@ -225,12 +333,12 @@ Item id: adhesionCheckBox property alias _hovered: adhesionMouseArea.containsMouse - anchors.top: parent.top + anchors.top: supportExtruderCombobox.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: adhesionHelperLabel.right anchors.leftMargin: UM.Theme.getSize("default_margin").width //: Setting enable printing build-plate adhesion helper checkbox - text: catalog.i18nc("@option:check", "Print Build Plate Adhesion"); style: UM.Theme.styles.checkbox; enabled: base.settingsEnabled @@ -269,98 +377,6 @@ Item } } - Label{ - id: supportHelperLabel - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: supportCheckBox.verticalCenter - width: parent.width / 100 * 35 - 3 * UM.Theme.getSize("default_margin").width - //: Support label - text: ""; - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - } - - CheckBox{ - id: supportCheckBox - visible: machineExtruderCount.properties.value <= 1 - property alias _hovered: supportMouseArea.containsMouse - - anchors.top: adhesionCheckBox.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.left: supportHelperLabel.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - - //: Setting enable support checkbox - text: catalog.i18nc("@option:check", "Print Support Structure"); - style: UM.Theme.styles.checkbox; - enabled: base.settingsEnabled - - checked: supportEnabled.properties.value == "True" - MouseArea { - id: supportMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - onClicked: - { - supportEnabled.setPropertyValue("value", !parent.checked) - } - onEntered: - { - base.showTooltip(supportCheckBox, Qt.point(-supportCheckBox.x, 0), - catalog.i18nc("@label", "Enable printing support structures. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); - } - onExited: - { - base.hideTooltip(); - } - } - } - - ComboBox { - id: supportExtruderCombobox - visible: machineExtruderCount.properties.value > 1 - model: extruderModel - - anchors.top: adhesionCheckBox.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.left: supportHelperLabel.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: parent.width / 100 * 65 - - style: UM.Theme.styles.combobox - enabled: base.settingsEnabled - property alias _hovered: supportExtruderMouseArea.containsMouse - - currentIndex: supportEnabled.properties.value == "True" ? parseFloat(supportExtruderNr.properties.value) + 1 : 0 - onActivated: { - if(index==0) { - supportEnabled.setPropertyValue("value", false); - } else { - supportEnabled.setPropertyValue("value", true); - // Send the extruder nr as a string. - supportExtruderNr.setPropertyValue("value", String(index - 1)); - } - } - MouseArea { - id: supportExtruderMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: base.settingsEnabled - acceptedButtons: Qt.NoButton - onEntered: - { - base.showTooltip(supportExtruderCombobox, Qt.point(-supportExtruderCombobox.x, 0), - catalog.i18nc("@label", "Select which extruder to use for support. This will build up supporting structures below the model to prevent the model from sagging or printing in mid air.")); - } - onExited: - { - base.hideTooltip(); - } - } - } - ListModel { id: extruderModel Component.onCompleted: populateExtruderModel() @@ -377,13 +393,9 @@ Item function populateExtruderModel() { extruderModel.clear(); - extruderModel.append({ - text: catalog.i18nc("@label", "Don't print support"), - color: "" - }) for(var extruderNumber = 0; extruderNumber < extruders.rowCount() ; extruderNumber++) { extruderModel.append({ - text: catalog.i18nc("@label", "Print support using %1").arg(extruders.getItem(extruderNumber).name), + text: extruders.getItem(extruderNumber).name, color: extruders.getItem(extruderNumber).color }) } @@ -438,7 +450,7 @@ Item containerStackId: Cura.MachineManager.activeMachineId key: "support_enable" - watchedProperties: [ "value" ] + watchedProperties: [ "value", "description" ] storeIndex: 0 } From 3acddddc7c6ef3c51c9943d5ea41449d4e0fc8ec Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 15 Nov 2016 17:09:19 +0100 Subject: [PATCH 2/8] Solve populating Support Extruder Combobox at first time start, adjusted spacings. CURA-2767 --- resources/qml/SidebarSimple.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index c9a7e12d07..4b8b31c2c2 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -214,7 +214,7 @@ Item anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: enableSupportCheckBox.verticalCenter - width: parent.width / 100 * 35 - 3 * UM.Theme.getSize("default_margin").width + width: parent.width / 100 * 45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Enable Support"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); @@ -259,7 +259,7 @@ Item anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: supportExtruderCombobox.verticalCenter - width: parent.width / 100 * 35 - 3 * UM.Theme.getSize("default_margin").width + width: parent.width / 100 * 45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Support Extruder"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); @@ -269,6 +269,7 @@ Item id: supportExtruderCombobox visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) model: extruderModel + textRole: 'text' // this solves that the combobox isn't populated in the first time Cura is started anchors.top: enableSupportCheckBox.bottom anchors.topMargin: { @@ -280,7 +281,7 @@ Item } anchors.left: supportExtruderLabel.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: parent.width / 100 * 65 + width: parent.width / 100 * 55 height: { if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) { // default height when control is enabled @@ -317,13 +318,12 @@ Item } } - Label{ id: adhesionHelperLabel anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: adhesionCheckBox.verticalCenter - width: parent.width / 100 * 35 - 3 * UM.Theme.getSize("default_margin").width + width: parent.width / 100 * 45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Build Plate Adhesion"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); From d448ed7e0863ec8c6d72f8569a586e4d594e2af5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 17 Nov 2016 09:59:14 +0100 Subject: [PATCH 3/8] Code style: Brackets on new line Contributes to issue CURA-2767. --- resources/qml/SidebarSimple.qml | 112 +++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 37 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 4b8b31c2c2..1509cd5f67 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2016 Ultimaker B.V. // Cura is released under the terms of the AGPLv3 or higher. import QtQuick 2.2 @@ -25,14 +25,16 @@ Item Component.onDestruction: PrintInformation.enabled = false UM.I18nCatalog { id: catalog; name:"cura"} - Rectangle{ + Rectangle + { id: infillCellLeft anchors.top: parent.top anchors.left: parent.left width: base.width / 100 * 35 - UM.Theme.getSize("default_margin").width height: childrenRect.height - Label{ + Label + { id: infillLabel //: Infill selection label text: catalog.i18nc("@label", "Infill"); @@ -45,7 +47,8 @@ Item } } - Flow { + Flow + { id: infillCellRight height: childrenRect.height; @@ -55,9 +58,11 @@ Item anchors.left: infillCellLeft.right anchors.top: infillCellLeft.top - Repeater { + Repeater + { id: infillListView - property int activeIndex: { + property int activeIndex: + { var density = parseInt(infillDensity.properties.value) for(var i = 0; i < infillModel.count; ++i) { @@ -71,17 +76,20 @@ Item } model: infillModel; - Item { + Item + { width: childrenRect.width; height: childrenRect.height; - Rectangle{ + Rectangle + { id: infillIconLining width: (infillCellRight.width - 3 * UM.Theme.getSize("default_margin").width) / 4; height: width - border.color: { + border.color: + { if(!base.settingsEnabled) { return UM.Theme.getColor("setting_control_disabled_border") @@ -97,7 +105,8 @@ Item return UM.Theme.getColor("setting_control_border") } border.width: UM.Theme.getSize("default_lining").width - color: { + color: + { if(infillListView.activeIndex == index) { if(!base.settingsEnabled) @@ -109,7 +118,8 @@ Item return "transparent" } - UM.RecolorImage { + UM.RecolorImage + { id: infillIcon anchors.fill: parent; anchors.margins: UM.Theme.getSize("infill_button_margin").width @@ -130,7 +140,8 @@ Item } } - MouseArea { + MouseArea + { id: infillMouseArea anchors.fill: parent hoverEnabled: true @@ -141,15 +152,18 @@ Item infillDensity.setPropertyValue("value", model.percentage) } } - onEntered: { + onEntered: + { base.showTooltip(infillCellRight, Qt.point(-infillCellRight.x, 0), model.text); } - onExited: { + onExited: + { base.hideTooltip(); } } } - Label{ + Label + { id: infillLabel font: UM.Theme.getFont("default") anchors.top: infillIconLining.bottom @@ -160,7 +174,8 @@ Item } } - ListModel { + ListModel + { id: infillModel Component.onCompleted: @@ -201,7 +216,8 @@ Item } } - Rectangle { + Rectangle + { id: helpersCell anchors.top: infillCellRight.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height @@ -209,7 +225,8 @@ Item anchors.right: parent.right height: childrenRect.height - Label{ + Label + { id: enableSupportLabel anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width @@ -220,7 +237,8 @@ Item color: UM.Theme.getColor("text"); } - CheckBox{ + CheckBox + { id: enableSupportCheckBox anchors.top: parent.top anchors.left: enableSupportLabel.right @@ -231,7 +249,8 @@ Item checked: supportEnabled.properties.value == "True"; - MouseArea { + MouseArea + { id: enableSupportMouseArea anchors.fill: parent hoverEnabled: true @@ -253,7 +272,8 @@ Item } } - Label{ + Label + { id: supportExtruderLabel visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) anchors.left: parent.left @@ -265,28 +285,37 @@ Item color: UM.Theme.getColor("text"); } - ComboBox { + ComboBox + { id: supportExtruderCombobox visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) model: extruderModel textRole: 'text' // this solves that the combobox isn't populated in the first time Cura is started anchors.top: enableSupportCheckBox.bottom - anchors.topMargin: { - if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) { + anchors.topMargin: + { + if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) + { return UM.Theme.getSize("default_margin").height; - } else { + } + else + { return 0; } } anchors.left: supportExtruderLabel.right anchors.leftMargin: UM.Theme.getSize("default_margin").width width: parent.width / 100 * 55 - height: { - if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) { + height: + { + if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) + { // default height when control is enabled return UM.Theme.getSize("setting_control").height; - } else { + } + else + { return 0; } } @@ -296,11 +325,13 @@ Item property alias _hovered: supportExtruderMouseArea.containsMouse currentIndex: parseFloat(supportExtruderNr.properties.value) // supportEnabled.properties.value == "True" ? parseFloat(supportExtruderNr.properties.value) : -1 - onActivated: { + onActivated: + { // Send the extruder nr as a string. supportExtruderNr.setPropertyValue("value", String(index)); } - MouseArea { + MouseArea + { id: supportExtruderMouseArea anchors.fill: parent hoverEnabled: true @@ -318,7 +349,8 @@ Item } } - Label{ + Label + { id: adhesionHelperLabel anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width @@ -329,7 +361,8 @@ Item color: UM.Theme.getColor("text"); } - CheckBox{ + CheckBox + { id: adhesionCheckBox property alias _hovered: adhesionMouseArea.containsMouse @@ -344,7 +377,8 @@ Item checked: platformAdhesionType.properties.value != "skirt" - MouseArea { + MouseArea + { id: adhesionMouseArea anchors.fill: parent hoverEnabled: true @@ -377,7 +411,8 @@ Item } } - ListModel { + ListModel + { id: extruderModel Component.onCompleted: populateExtruderModel() } @@ -393,7 +428,8 @@ Item function populateExtruderModel() { extruderModel.clear(); - for(var extruderNumber = 0; extruderNumber < extruders.rowCount() ; extruderNumber++) { + for(var extruderNumber = 0; extruderNumber < extruders.rowCount() ; extruderNumber++) + { extruderModel.append({ text: extruders.getItem(extruderNumber).name, color: extruders.getItem(extruderNumber).color @@ -401,7 +437,8 @@ Item } } - Rectangle { + Rectangle + { id: tipsCell anchors.top: helpersCell.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height @@ -409,7 +446,8 @@ Item width: parent.width height: childrenRect.height - Label{ + Label + { anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: parent.right From 79e8fc210a8a3e20e256f232cdcff2470ca5350c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 17 Nov 2016 10:24:19 +0100 Subject: [PATCH 4/8] Remove commented code Contributes to issue CURA-2767. --- resources/qml/SidebarSimple.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 1509cd5f67..3798797509 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -324,7 +324,7 @@ Item enabled: base.settingsEnabled property alias _hovered: supportExtruderMouseArea.containsMouse - currentIndex: parseFloat(supportExtruderNr.properties.value) // supportEnabled.properties.value == "True" ? parseFloat(supportExtruderNr.properties.value) : -1 + currentIndex: parseFloat(supportExtruderNr.properties.value) onActivated: { // Send the extruder nr as a string. From ef6e90283e544b666bee73d47e7bce358f42b041 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 1 Dec 2016 11:34:37 +0100 Subject: [PATCH 5/8] Added color to recommended view support extruder by adding combobox_color style. CURA-2767 --- resources/qml/SidebarSimple.qml | 11 ++++- resources/themes/cura/styles.qml | 74 ++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 3798797509..e84092b290 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -290,6 +290,12 @@ Item id: supportExtruderCombobox visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) model: extruderModel + property string color: + { + var model_color = extruderModel.get(currentIndex).color; + return (model_color) ? model_color : ""; + } + textRole: 'text' // this solves that the combobox isn't populated in the first time Cura is started anchors.top: enableSupportCheckBox.bottom @@ -320,7 +326,7 @@ Item } } - style: UM.Theme.styles.combobox + style: UM.Theme.styles.combobox_color enabled: base.settingsEnabled property alias _hovered: supportExtruderMouseArea.containsMouse @@ -347,6 +353,9 @@ Item base.hideTooltip(); } } + + // color rectangle + } Label diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index cc6bdfed77..afcb0b1763 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -411,6 +411,80 @@ QtObject { } } + // Combobox with items with colored rectangles + property Component combobox_color: Component { + ComboBoxStyle + { + background: Rectangle + { + color: + { + if (!enabled) + { + return UM.Theme.getColor("setting_control_disabled"); + } + if(control.hovered) + { + return UM.Theme.getColor("setting_control_highlight"); + } + else + { + return UM.Theme.getColor("setting_control"); + } + } + border.width: UM.Theme.getSize("default_lining").width + border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") + } + label: Item + { + Rectangle + { + id: swatch + height: UM.Theme.getSize("setting_control").height / 2 + width: height + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_lining").width + anchors.verticalCenter: parent.verticalCenter + + color: control.color + border.width: UM.Theme.getSize("default_lining").width + border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border") + } + Label + { + anchors.left: swatch.right + 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: control.currentText + font: UM.Theme.getFont("default") + color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") + + 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("arrow_bottom") + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + 5 + sourceSize.height: width + 5 + + color: UM.Theme.getColor("setting_control_text") + } + } + } + } + property Component checkbox: Component { CheckBoxStyle { background: Item { } From 14701d89d00edf35930775aa6c94bfdf8134199e Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 1 Dec 2016 14:50:40 +0100 Subject: [PATCH 6/8] Finally got edge cases regarding recommended mode support extruder color working. CURA-2767 --- resources/qml/SidebarSimple.qml | 24 ++++++++++++++++++++---- resources/themes/cura/styles.qml | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index e84092b290..b4dd91ac36 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -290,9 +290,18 @@ Item id: supportExtruderCombobox visible: (supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1) model: extruderModel - property string color: + + property string color_override: "" // for manually setting values + property string color: // is evaluated automatically, but the first time is before extruderModel being filled { - var model_color = extruderModel.get(currentIndex).color; + CuraApplication.log(" normal color evaluation"); + + var current_extruder = extruderModel.get(currentIndex); + color_override = ""; + if (current_extruder === undefined) { + return ""; + } + var model_color = current_extruder.color; return (model_color) ? model_color : ""; } @@ -330,7 +339,7 @@ Item enabled: base.settingsEnabled property alias _hovered: supportExtruderMouseArea.containsMouse - currentIndex: parseFloat(supportExtruderNr.properties.value) + currentIndex: parseFloat(supportExtruderNr.properties.value)q onActivated: { // Send the extruder nr as a string. @@ -354,7 +363,13 @@ Item } } - // color rectangle + function updateCurrentColor() + { + var current_extruder = extruderModel.get(currentIndex); + if (current_extruder !== undefined) { + supportExtruderCombobox.color_override = current_extruder.color; + } + } } @@ -444,6 +459,7 @@ Item color: extruders.getItem(extruderNumber).color }) } + supportExtruderCombobox.updateCurrentColor(); } Rectangle diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index afcb0b1763..a57f60b387 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -446,7 +446,7 @@ QtObject { anchors.leftMargin: UM.Theme.getSize("default_lining").width anchors.verticalCenter: parent.verticalCenter - color: control.color + color: if (control.color_override != "") {return control.color_override} else {return control.color;} border.width: UM.Theme.getSize("default_lining").width border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border") } From 8ff233871fb744963de95d48e005565ef912a765 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 1 Dec 2016 14:51:41 +0100 Subject: [PATCH 7/8] Fixed typo. CURA-2767 --- resources/qml/SidebarSimple.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index b4dd91ac36..8b42b2bc91 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -339,7 +339,7 @@ Item enabled: base.settingsEnabled property alias _hovered: supportExtruderMouseArea.containsMouse - currentIndex: parseFloat(supportExtruderNr.properties.value)q + currentIndex: parseFloat(supportExtruderNr.properties.value) onActivated: { // Send the extruder nr as a string. From 8c5d97f6a05510a1ea5f7f42287fe9fd907f517c Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 1 Dec 2016 14:52:40 +0100 Subject: [PATCH 8/8] Removed log. CURA-2767 --- resources/qml/SidebarSimple.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 8b42b2bc91..cc46292fe4 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -294,8 +294,6 @@ Item property string color_override: "" // for manually setting values property string color: // is evaluated automatically, but the first time is before extruderModel being filled { - CuraApplication.log(" normal color evaluation"); - var current_extruder = extruderModel.get(currentIndex); color_override = ""; if (current_extruder === undefined) {