mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 04:26:05 +08:00
Update swatches on swatch color property changed
CURA-8938
This commit is contained in:
parent
0786ff2c6b
commit
301d68ebf2
@ -27,11 +27,15 @@ UM.Dialog
|
|||||||
"#FFFFFF", "#D3D3D3", "#9E9E9E", "#5A5A5A", "#000000",
|
"#FFFFFF", "#D3D3D3", "#9E9E9E", "#5A5A5A", "#000000",
|
||||||
]
|
]
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted: updateSwatches()
|
||||||
|
onSwatchColorsChanged: updateSwatches()
|
||||||
|
|
||||||
|
function updateSwatches()
|
||||||
{
|
{
|
||||||
for (let i = 0; i < base.swatchColors.length; i ++)
|
swatchColorsModel.clear();
|
||||||
|
for (const swatchColor of base.swatchColors)
|
||||||
{
|
{
|
||||||
swatchColorsModel.append({ swatchColor: base.swatchColors[i] });
|
swatchColorsModel.append({ swatchColor });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,22 @@ Item
|
|||||||
id: colorDialog
|
id: colorDialog
|
||||||
title: catalog.i18nc("@title", "Material color picker")
|
title: catalog.i18nc("@title", "Material color picker")
|
||||||
color: properties.color_code
|
color: properties.color_code
|
||||||
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color)
|
// swatchColors: ["#2161AF", "#57AFB2", "#F7B32D", "#E33D4A", "#C088AD"]
|
||||||
|
onAccepted: {
|
||||||
|
base.setMetaDataEntry("color_code", properties.color_code, color);
|
||||||
|
console.log("color_code");
|
||||||
|
|
||||||
|
const timer = Qt.createQmlObject("import QtQuick 2.0; Timer {}", base);
|
||||||
|
timer.interval = 10000;
|
||||||
|
timer.repeat = true;
|
||||||
|
timer.triggered.connect(function () {
|
||||||
|
console.log("updating colors");
|
||||||
|
colorDialog.swatchColors = ["#2161AF", "#57AFB2", "#F7B32D", "#E33D4A", "#C088AD"];
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log("starting timers");
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user