From 0ed49310567aade4123106fad316b5a216b48a9d Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Sun, 12 Apr 2020 15:46:13 +0200 Subject: [PATCH] Add additional information to tooltips in object selector --- resources/qml/ObjectItemButton.qml | 54 ++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/resources/qml/ObjectItemButton.qml b/resources/qml/ObjectItemButton.qml index 52f97ffe65..9244fa6391 100644 --- a/resources/qml/ObjectItemButton.qml +++ b/resources/qml/ObjectItemButton.qml @@ -14,7 +14,7 @@ Button width: parent.width height: UM.Theme.getSize("action_button").height leftPadding: UM.Theme.getSize("thin_margin").width - rightPadding: UM.Theme.getSize("default_lining").width + rightPadding: perObjectSettingsInfo.visible ? UM.Theme.getSize("default_lining").width : UM.Theme.getSize("thin_margin").width checkable: true hoverEnabled: true @@ -87,10 +87,44 @@ Button UM.Controller.setActiveTool("PerObjectSettingsTool") } + property string tooltipText: + { + var result = ""; + if (!visible) + { + return result; + } + if (meshType != "") + { + result += "
"; + 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 += "
" + catalog.i18ncp( + "@label", "Overrides %1 setting.", "Overrides %1 settings.", perObjectSettingsCount + ).arg(perObjectSettingsCount); + } + return result; + } + contentItem: Item { height: parent.height - width: childrenRect.width + width: meshTypeIcon.width + perObjectSettingsCountLabel.width + UM.Theme.getSize("narrow_margin").width Cura.NotificationIcon { @@ -107,6 +141,7 @@ Button UM.RecolorImage { + id: meshTypeIcon anchors { right: perObjectSettingsCountLabel.left @@ -121,12 +156,12 @@ Button { switch (meshType) { case "support_mesh": - return UM.Theme.getIcon("pos_print_as_support") + return UM.Theme.getIcon("pos_print_as_support"); case "cutting_mesh": case "infill_mesh": - return UM.Theme.getIcon("pos_modify_overlaps") + return UM.Theme.getIcon("pos_modify_overlaps"); case "anti_overhang_mesh": - return UM.Theme.getIcon("pos_modify_dont_support_overlap") + return UM.Theme.getIcon("pos_modify_dont_support_overlap"); } return ""; } @@ -149,8 +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) } + UM.I18nCatalog + { + id: catalog + name: "cura" + } }