Merge branch 'master' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2016-06-06 10:19:14 +02:00
commit ffd309f816
10 changed files with 54 additions and 41 deletions

View file

@ -16,17 +16,18 @@ SettingItem
{
id: control
model: Cura.ExtrudersModel {
model: Cura.ExtrudersModel
{
id: extruders_model
}
textRole: "name";
textRole: "name"
anchors.fill: parent
MouseArea
{
anchors.fill: parent;
acceptedButtons: Qt.NoButton;
anchors.fill: parent
acceptedButtons: Qt.NoButton
onWheel: wheel.accepted = true;
}
@ -38,44 +39,44 @@ SettingItem
{
if (!enabled)
{
return UM.Theme.getColor("setting_control_disabled")
return UM.Theme.getColor("setting_control_disabled");
}
if(control.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight")
return UM.Theme.getColor("setting_control_highlight");
}
else
{
return UM.Theme.getColor("setting_control")
return extruders_model.getItem(index).colour;
}
}
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");
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
{
Label
{
anchors.left: parent.left;
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;
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");
text: control.currentText
font: UM.Theme.getFont("default")
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : extruders_model.getItem(index).colour
elide: Text.ElideRight;
verticalAlignment: Text.AlignVCenter;
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;
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
@ -83,29 +84,30 @@ SettingItem
sourceSize.width: width + 5
sourceSize.height: width + 5
color: UM.Theme.getColor("setting_control_text");
color: UM.Theme.getColor("setting_control_text")
}
}
}
onActivated: provider.setPropertyValue("value", extruders_model.getItem(index).index)
onActivated: provider.setPropertyValue("value", extruders_model.getItem(index).index);
onModelChanged: updateCurrentIndex();
Connections
{
target: provider
onPropertiesChanged: control.updateCurrentIndex()
onPropertiesChanged: control.updateCurrentIndex();
}
function updateCurrentIndex() {
for(var i = 0; i < extruders_model.rowCount(); ++i) {
if(extruders_model.getItem(i).index == provider.properties.value) {
function updateCurrentIndex()
{
for(var i = 0; i < extruders_model.rowCount(); ++i)
{
if(extruders_model.getItem(i).index == provider.properties.value)
{
currentIndex = i;
return;
}
}
currentIndex = -1;
}
}

View file

@ -49,7 +49,7 @@ ScrollView
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
asynchronous: model.type != "enum"
asynchronous: model.type != "enum" && model.type != "extruder"
active: model.type != undefined
source: