mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:35:57 +08:00
Set colours of extruder selection to material colour
Ubuntu Unity doesn't seem to listen to these colours at all though. Contributes to issues CURA-1278 and CURA-351.
This commit is contained in:
parent
c50d0a97da
commit
a948c7bcc6
@ -16,17 +16,18 @@ SettingItem
|
|||||||
{
|
{
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
model: Cura.ExtrudersModel {
|
model: Cura.ExtrudersModel
|
||||||
|
{
|
||||||
id: extruders_model
|
id: extruders_model
|
||||||
}
|
}
|
||||||
textRole: "name";
|
textRole: "name"
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
anchors.fill: parent;
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.NoButton;
|
acceptedButtons: Qt.NoButton
|
||||||
onWheel: wheel.accepted = true;
|
onWheel: wheel.accepted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,44 +39,44 @@ SettingItem
|
|||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_disabled")
|
return UM.Theme.getColor("setting_control_disabled");
|
||||||
}
|
}
|
||||||
if(control.hovered || base.activeFocus)
|
if(control.hovered || base.activeFocus)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_highlight")
|
return UM.Theme.getColor("setting_control_highlight");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control")
|
return extruders_model.getItem(index).colour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
border.width: UM.Theme.getSize("default_lining").width;
|
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.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: Item
|
||||||
{
|
{
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||||
anchors.right: downArrow.left;
|
anchors.right: downArrow.left
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_lining").width;
|
anchors.rightMargin: UM.Theme.getSize("default_lining").width
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
text: control.currentText;
|
text: control.currentText
|
||||||
font: UM.Theme.getFont("default");
|
font: UM.Theme.getFont("default")
|
||||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
|
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : extruders_model.getItem(index).colour
|
||||||
|
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight
|
||||||
verticalAlignment: Text.AlignVCenter;
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: downArrow
|
id: downArrow
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2;
|
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
source: UM.Theme.getIcon("arrow_bottom")
|
source: UM.Theme.getIcon("arrow_bottom")
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
@ -83,29 +84,30 @@ SettingItem
|
|||||||
sourceSize.width: width + 5
|
sourceSize.width: width + 5
|
||||||
sourceSize.height: 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();
|
onModelChanged: updateCurrentIndex();
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: provider
|
target: provider
|
||||||
onPropertiesChanged: control.updateCurrentIndex()
|
onPropertiesChanged: control.updateCurrentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCurrentIndex() {
|
function updateCurrentIndex()
|
||||||
for(var i = 0; i < extruders_model.rowCount(); ++i) {
|
{
|
||||||
if(extruders_model.getItem(i).index == provider.properties.value) {
|
for(var i = 0; i < extruders_model.rowCount(); ++i)
|
||||||
|
{
|
||||||
|
if(extruders_model.getItem(i).index == provider.properties.value)
|
||||||
|
{
|
||||||
currentIndex = i;
|
currentIndex = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentIndex = -1;
|
currentIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user