mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Rename ExtruderSelectorBar -> SingleSettingExtruderSelectorBar to be inline with new single setting widgets.
Move common functionality into SingleSettingExtruderSelectorBar Add adhesion settings CURA-9793
This commit is contained in:
parent
c240833868
commit
c356b9d46f
@ -1,10 +1,11 @@
|
|||||||
// Copyright (c) 2022 Ultimaker B.V.
|
// Copyright (c) 2022 UltiMaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
import UM 1.5 as UM
|
import UM 1.5 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.7 as Cura
|
||||||
|
|
||||||
|
|
||||||
RecommendedSettingSection
|
RecommendedSettingSection
|
||||||
@ -32,16 +33,12 @@ RecommendedSettingSection
|
|||||||
curaRecommendedMode.setAdhesion(state)
|
curaRecommendedMode.setAdhesion(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
contents: RecommendedSettingItem
|
contents: [
|
||||||
{
|
RecommendedSettingItem
|
||||||
settingName: catalog.i18nc("@action:label", "Print with")
|
|
||||||
|
|
||||||
settingControl: Rectangle
|
|
||||||
{
|
{
|
||||||
width: 20
|
Layout.preferredHeight: childrenRect.height
|
||||||
height: 20
|
settingName: catalog.i18nc("@action:label", "Print with")
|
||||||
color: Qt.rgba(1, 0, 0, .5)
|
settingControl: Cura.SingleSettingExtruderSelectorBar { extruderSettingName: "adhesion_extruder_nr" }
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2022 Ultimaker B.V.
|
// Copyright (c) 2022 UltiMaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.10
|
import QtQuick 2.10
|
||||||
@ -24,9 +24,6 @@ RecommendedSettingSection
|
|||||||
supportEnabled.setPropertyValue("value", state)
|
supportEnabled.setPropertyValue("value", state)
|
||||||
}
|
}
|
||||||
|
|
||||||
property var extruderModel: CuraApplication.getExtrudersModel()
|
|
||||||
|
|
||||||
|
|
||||||
property UM.SettingPropertyProvider supportEnabled: UM.SettingPropertyProvider
|
property UM.SettingPropertyProvider supportEnabled: UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: supportEnabled
|
id: supportEnabled
|
||||||
@ -68,19 +65,8 @@ RecommendedSettingSection
|
|||||||
{
|
{
|
||||||
Layout.preferredHeight: childrenRect.height
|
Layout.preferredHeight: childrenRect.height
|
||||||
settingName: catalog.i18nc("@action:label", "Print with")
|
settingName: catalog.i18nc("@action:label", "Print with")
|
||||||
settingControl: Cura.ExtruderSelectorBar
|
settingControl: Cura.SingleSettingExtruderSelectorBar { extruderSettingName: "support_extruder_nr" }
|
||||||
{
|
|
||||||
model: extruderModel
|
|
||||||
selectedIndex: supportExtruderNr.properties.value !== undefined ? supportExtruderNr.properties.value : 0
|
|
||||||
function onClickExtruder(index)
|
|
||||||
{
|
|
||||||
forceActiveFocus();
|
|
||||||
supportExtruderNr.setPropertyValue("value", index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
RecommendedSettingItem
|
RecommendedSettingItem
|
||||||
{
|
{
|
||||||
settingName: catalog.i18nc("@action:label", "Placement")
|
settingName: catalog.i18nc("@action:label", "Placement")
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
import QtQuick 2.12
|
|
||||||
import QtQuick.Controls 2.12
|
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
|
|
||||||
import UM 1.5 as UM
|
|
||||||
import Cura 1.5 as Cura
|
|
||||||
|
|
||||||
Row
|
|
||||||
{
|
|
||||||
id: extruderSelectionBar
|
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
height: childrenRect.height
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
property alias model: extruderButtonRepeater.model
|
|
||||||
property int selectedIndex: 0
|
|
||||||
function onClickExtruder(index) {}
|
|
||||||
|
|
||||||
|
|
||||||
Repeater
|
|
||||||
{
|
|
||||||
id: extruderButtonRepeater
|
|
||||||
|
|
||||||
delegate: Item
|
|
||||||
{
|
|
||||||
width: {
|
|
||||||
const maximum_width = Math.floor(extruderSelectionBar.width / extruderButtonRepeater.count);
|
|
||||||
return Math.min(UM.Theme.getSize("large_button").width, maximum_width);
|
|
||||||
}
|
|
||||||
height: childrenRect.height
|
|
||||||
|
|
||||||
Cura.ExtruderButton
|
|
||||||
{
|
|
||||||
extruder: model
|
|
||||||
checked: extruder.index == selectedIndex
|
|
||||||
iconScale: 0.6
|
|
||||||
buttonSize: UM.Theme.getSize("large_button").width
|
|
||||||
onClicked: extruder.enabled && onClickExtruder(extruder.index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,7 @@ Cura.ComboBox {
|
|||||||
id: comboboxModel
|
id: comboboxModel
|
||||||
|
|
||||||
// The propertyProvider has not loaded the setting when this components onComplete triggers. Populating the model
|
// The propertyProvider has not loaded the setting when this components onComplete triggers. Populating the model
|
||||||
// is defered until propertyProvider signals "onIsValueUsedChanged".
|
// is defered until propertyProvider signals "onIsValueUsedChanged". The defered upate is triggered with this function.
|
||||||
function updateModel()
|
function updateModel()
|
||||||
{
|
{
|
||||||
clear()
|
clear()
|
||||||
|
64
resources/qml/Widgets/SingleSettingExtruderSelectorBar.qml
Normal file
64
resources/qml/Widgets/SingleSettingExtruderSelectorBar.qml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import QtQuick 2.12
|
||||||
|
import QtQuick.Controls 2.12
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
import UM 1.5 as UM
|
||||||
|
import Cura 1.5 as Cura
|
||||||
|
|
||||||
|
// This component displays a row of extruder icons, clicking on the extruder will update the setting passed to "settingName"
|
||||||
|
// with the index of that extruder.
|
||||||
|
// This will only work for settings that take an extruder index.
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
id: extruderSelectionBar
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
height: childrenRect.height
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
property int selectedIndex: extruderSettingProvider.properties.value !== undefined ? extruderSettingProvider.properties.value : 0
|
||||||
|
property alias model: extruderButtonRepeater.model
|
||||||
|
property alias extruderSettingName: extruderSettingProvider.key
|
||||||
|
property alias containerStack: extruderSettingProvider.containerStack
|
||||||
|
|
||||||
|
property UM.SettingPropertyProvider extruderSettingProvider: UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: extruderSettingProvider
|
||||||
|
containerStack: Cura.MachineManager.activeMachine
|
||||||
|
watchedProperties: [ "value" ]
|
||||||
|
storeIndex: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function onClickExtruder(index)
|
||||||
|
{
|
||||||
|
forceActiveFocus();
|
||||||
|
extruderSettingProvider.setPropertyValue("value", index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
id: extruderButtonRepeater
|
||||||
|
|
||||||
|
model: CuraApplication.getExtrudersModel()
|
||||||
|
|
||||||
|
delegate: Item
|
||||||
|
{
|
||||||
|
width: {
|
||||||
|
// This will "squish" the extruder buttons together when the fill up the horizontal space
|
||||||
|
const maximum_width = Math.floor(extruderSelectionBar.width / extruderButtonRepeater.count);
|
||||||
|
return Math.min(UM.Theme.getSize("large_button").width, maximum_width);
|
||||||
|
}
|
||||||
|
height: childrenRect.height
|
||||||
|
|
||||||
|
Cura.ExtruderButton
|
||||||
|
{
|
||||||
|
extruder: model
|
||||||
|
checked: extruder.index == selectedIndex
|
||||||
|
iconScale: 0.6
|
||||||
|
buttonSize: UM.Theme.getSize("large_button").width
|
||||||
|
onClicked: extruder.enabled && onClickExtruder(extruder.index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -38,9 +38,9 @@ ScrollView 1.0 ScrollView.qml
|
|||||||
Menu 1.0 Menu.qml
|
Menu 1.0 Menu.qml
|
||||||
MenuItem 1.0 MenuItem.qml
|
MenuItem 1.0 MenuItem.qml
|
||||||
MenuSeparator 1.0 MenuSeparator.qml
|
MenuSeparator 1.0 MenuSeparator.qml
|
||||||
ExtruderSelectorBar 1.6 ExtruderSelectorBar.qml
|
SingleSettingExtruderSelectorBar 1.7 SingleSettingExtruderSelectorBar.qml
|
||||||
ExtruderButton 1.6 ExtruderButton.qml
|
ExtruderButton 1.7 ExtruderButton.qml
|
||||||
SingleSettingComboBox 1.7 SingleSettingComboBox.qml
|
SingleSettingComboBox 1.7 SingleSettingComboBox.qml
|
||||||
|
|
||||||
|
|
||||||
# Cura/MachineSettings
|
# Cura/MachineSettings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user