mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 21:45:51 +08:00
Add PropertyProviders to SidebarSimple and use them for property values
This commit is contained in:
parent
b1df8e9448
commit
e4fe1c6e21
@ -6,7 +6,8 @@ import QtQuick.Controls 1.1
|
|||||||
import QtQuick.Controls.Styles 1.1
|
import QtQuick.Controls.Styles 1.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
@ -56,12 +57,7 @@ Item
|
|||||||
Repeater {
|
Repeater {
|
||||||
id: infillListView
|
id: infillListView
|
||||||
property int activeIndex: {
|
property int activeIndex: {
|
||||||
if(!UM.ActiveProfile.valid)
|
var density = parseInt(infillDensity.properties.value)
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// var density = parseInt(UM.ActiveProfile.settingValues.getValue("infill_sparse_density"));
|
|
||||||
for(var i = 0; i < infillModel.count; ++i)
|
for(var i = 0; i < infillModel.count; ++i)
|
||||||
{
|
{
|
||||||
if(density > infillModel.get(i).percentageMin && density <= infillModel.get(i).percentageMax )
|
if(density > infillModel.get(i).percentageMin && density <= infillModel.get(i).percentageMax )
|
||||||
@ -116,7 +112,7 @@ Item
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
if (infillListView.activeIndex != index)
|
if (infillListView.activeIndex != index)
|
||||||
{
|
{
|
||||||
// UM.MachineManager.setSettingValue("infill_sparse_density", model.percentage)
|
infillDensity.setPropertyValue("value", model.percentage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
@ -213,13 +209,14 @@ Item
|
|||||||
text: catalog.i18nc("@option:check","Generate Brim");
|
text: catalog.i18nc("@option:check","Generate Brim");
|
||||||
style: UM.Theme.styles.checkbox;
|
style: UM.Theme.styles.checkbox;
|
||||||
|
|
||||||
// checked: UM.ActiveProfile.valid ? UM.ActiveProfile.settingValues.getValue("adhesion_type") == "brim" : false;
|
checked: platformAdhesionType.properties.value == "brim"
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
// UM.MachineManager.setSettingValue("adhesion_type", !parent.checked?"brim":"skirt")
|
platformAdhesionType.setPropertyValue("value", !parent.checked ? "brim" : "skirt")
|
||||||
}
|
}
|
||||||
onEntered:
|
onEntered:
|
||||||
{
|
{
|
||||||
@ -246,13 +243,13 @@ Item
|
|||||||
text: catalog.i18nc("@option:check","Generate Support Structure");
|
text: catalog.i18nc("@option:check","Generate Support Structure");
|
||||||
style: UM.Theme.styles.checkbox;
|
style: UM.Theme.styles.checkbox;
|
||||||
|
|
||||||
// checked: UM.ActiveProfile.valid ? UM.ActiveProfile.settingValues.getValue("support_enable") : false;
|
checked: supportEnabled.properties.value == "True"
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
// UM.MachineManager.setSettingValue("support_enable", !parent.checked)
|
supportEnabled.setPropertyValue("value", !parent.checked)
|
||||||
}
|
}
|
||||||
onEntered:
|
onEntered:
|
||||||
{
|
{
|
||||||
@ -371,4 +368,36 @@ Item
|
|||||||
onLinkActivated: Qt.openUrlExternally(link)
|
onLinkActivated: Qt.openUrlExternally(link)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: infillDensity
|
||||||
|
|
||||||
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
|
key: "infill_sparse_density"
|
||||||
|
watchedProperties: [ "value" ]
|
||||||
|
storeIndex: 0
|
||||||
|
|
||||||
|
onPropertiesChanged: console.log(properties.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: platformAdhesionType
|
||||||
|
|
||||||
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
|
key: "adhesion_type"
|
||||||
|
watchedProperties: [ "value" ]
|
||||||
|
storeIndex: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: supportEnabled
|
||||||
|
|
||||||
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
|
key: "support_enable"
|
||||||
|
watchedProperties: [ "value" ]
|
||||||
|
storeIndex: 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user