mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-29 22:01:14 -07:00
Merge branch 'feature_objectlist_improvements' of https://github.com/fieldOfView/Cura
This commit is contained in:
commit
9e68bcb7a0
5 changed files with 295 additions and 35 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Copyright (c) 2020 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
|
@ -14,33 +14,11 @@ Button
|
|||
width: parent.width
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
leftPadding: UM.Theme.getSize("thin_margin").width
|
||||
rightPadding: UM.Theme.getSize("thin_margin").width
|
||||
rightPadding: perObjectSettingsInfo.visible ? UM.Theme.getSize("default_lining").width : UM.Theme.getSize("thin_margin").width
|
||||
checkable: true
|
||||
hoverEnabled: true
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
width: objectItemButton.width - objectItemButton.leftPadding
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
|
||||
Label
|
||||
{
|
||||
id: buttonText
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: objectItemButton.text
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text_scene")
|
||||
visible: text != ""
|
||||
renderType: Text.NativeRendering
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
onClicked: Cura.SceneController.changeSelection(index)
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
|
|
@ -51,6 +29,149 @@ Button
|
|||
border.color: objectItemButton.checked ? UM.Theme.getColor("primary") : "transparent"
|
||||
}
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
width: objectItemButton.width - objectItemButton.leftPadding
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: swatch
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
width: height
|
||||
height: parent.height - UM.Theme.getSize("narrow_margin").height
|
||||
source: UM.Theme.getIcon("extruder_button")
|
||||
color: extruderColor
|
||||
visible: showExtruderSwatches && extruderColor != ""
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: buttonText
|
||||
anchors
|
||||
{
|
||||
left: showExtruderSwatches ? swatch.right : parent.left
|
||||
leftMargin: showExtruderSwatches ? UM.Theme.getSize("narrow_margin").width : 0
|
||||
right: perObjectSettingsInfo.visible ? perObjectSettingsInfo.left : parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: objectItemButton.text
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text_scene")
|
||||
opacity: (outsideBuildArea) ? 0.5 : 1.0
|
||||
visible: text != ""
|
||||
renderType: Text.NativeRendering
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: perObjectSettingsInfo
|
||||
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
rightMargin: 0
|
||||
}
|
||||
width: childrenRect.width
|
||||
height: parent.height
|
||||
padding: 0
|
||||
leftPadding: UM.Theme.getSize("thin_margin").width
|
||||
visible: meshType != "" || perObjectSettingsCount > 0
|
||||
|
||||
onClicked:
|
||||
{
|
||||
Cura.SceneController.changeSelection(index)
|
||||
UM.Controller.setActiveTool("PerObjectSettingsTool")
|
||||
}
|
||||
|
||||
property string tooltipText:
|
||||
{
|
||||
var result = "";
|
||||
if (!visible)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (meshType != "")
|
||||
{
|
||||
result += "<br>";
|
||||
switch (meshType) {
|
||||
case "support_mesh":
|
||||
result += catalog.i18nc("@label", "Is printed as support.");
|
||||
break;
|
||||
case "cutting_mesh":
|
||||
result += catalog.i18nc("@label", "Other models overlapping with this model are modified.");
|
||||
break;
|
||||
case "infill_mesh":
|
||||
result += catalog.i18nc("@label", "Infill overlapping with this model is modified.");
|
||||
break;
|
||||
case "anti_overhang_mesh":
|
||||
result += catalog.i18nc("@label", "Overlaps with this model are not supported.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (perObjectSettingsCount != "")
|
||||
{
|
||||
result += "<br>" + catalog.i18ncp(
|
||||
"@label", "Overrides %1 setting.", "Overrides %1 settings.", perObjectSettingsCount
|
||||
).arg(perObjectSettingsCount);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
height: parent.height
|
||||
width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width
|
||||
|
||||
Cura.NotificationIcon
|
||||
{
|
||||
id: perObjectSettingsCountLabel
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
rightMargin: 0
|
||||
}
|
||||
visible: perObjectSettingsCount > 0
|
||||
color: UM.Theme.getColor("text_scene")
|
||||
labelText: perObjectSettingsCount.toString()
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: meshTypeIcon
|
||||
anchors
|
||||
{
|
||||
right: perObjectSettingsCountLabel.left
|
||||
rightMargin: UM.Theme.getSize("narrow_margin").width
|
||||
}
|
||||
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
color: UM.Theme.getColor("text_scene")
|
||||
visible: meshType != ""
|
||||
source:
|
||||
{
|
||||
switch (meshType) {
|
||||
case "support_mesh":
|
||||
return UM.Theme.getIcon("pos_print_as_support");
|
||||
case "cutting_mesh":
|
||||
case "infill_mesh":
|
||||
return UM.Theme.getIcon("pos_modify_overlaps");
|
||||
case "anti_overhang_mesh":
|
||||
return UM.Theme.getIcon("pos_modify_dont_support_overlap");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
}
|
||||
}
|
||||
|
||||
TextMetrics
|
||||
{
|
||||
id: buttonTextMetrics
|
||||
|
|
@ -63,9 +184,13 @@ Button
|
|||
Cura.ToolTip
|
||||
{
|
||||
id: tooltip
|
||||
tooltipText: objectItemButton.text
|
||||
visible: objectItemButton.hovered && buttonTextMetrics.elidedText != buttonText.text
|
||||
tooltipText: objectItemButton.text + perObjectSettingsInfo.tooltipText
|
||||
visible: objectItemButton.hovered && (buttonTextMetrics.elidedText != buttonText.text || perObjectSettingsInfo.visible)
|
||||
}
|
||||
|
||||
onClicked: Cura.SceneController.changeSelection(index)
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Copyright (c) 2020 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
|
@ -87,6 +87,17 @@ Item
|
|||
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
}
|
||||
|
||||
ListView
|
||||
{
|
||||
id: listView
|
||||
|
|
@ -120,6 +131,19 @@ Item
|
|||
}
|
||||
text: model.name
|
||||
width: listView.width
|
||||
property bool outsideBuildArea: model.outside_build_area
|
||||
property int perObjectSettingsCount: model.per_object_settings_count
|
||||
property string meshType: model.mesh_type
|
||||
property int extruderNumber: model.extruder_number
|
||||
property string extruderColor:
|
||||
{
|
||||
if (model.extruder_number == -1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return contents.extrudersModel.getItem(model.extruder_number).color;
|
||||
}
|
||||
property bool showExtruderSwatches: machineExtruderCount.properties.value > 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue