From 67b72ee6df81c138af23bcf8ac09cfb7cfd63adc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 16 Feb 2017 14:46:15 +0100 Subject: [PATCH] Add tooltips for elements of extruder box All things that need a tooltip now have their tooltip. The tooltips don't seem to align well though. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 776d28dacb..bd2e2aac74 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -96,12 +96,35 @@ Column } Label //Temperature indication. { + id: extruderTemperature text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null && connectedPrinter.hotendTemperatures[index] != null) ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" color: UM.Theme.getColor("text") font: UM.Theme.getFont("large") anchors.right: parent.right anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width + + MouseArea //For tooltip. + { + id: extruderTemperatureTooltipArea + hoverEnabled: true + anchors.fill: parent + onHoveredChanged: + { + if (containsMouse) + { + base.showTooltip( + base, + {x: 0, y: parent.mapToItem(base, 0, 0).y}, + catalog.i18nc("@tooltip", "The current temperature of this extruder.") + ); + } + else + { + base.hideTooltip(); + } + } + } } Rectangle //Material colour indication. { @@ -115,6 +138,28 @@ Column anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: materialName.verticalCenter + + MouseArea //For tooltip. + { + id: materialColorTooltipArea + hoverEnabled: true + anchors.fill: parent + onHoveredChanged: + { + if (containsMouse) + { + base.showTooltip( + base, + {x: 0, y: parent.mapToItem(base, 0, 0).y}, + catalog.i18nc("@tooltip", "The colour of the material in this extruder.") + ); + } + else + { + base.hideTooltip(); + } + } + } } Label //Material name. { @@ -125,15 +170,60 @@ Column anchors.left: materialColor.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width + + MouseArea //For tooltip. + { + id: materialNameTooltipArea + hoverEnabled: true + anchors.fill: parent + onHoveredChanged: + { + if (containsMouse) + { + base.showTooltip( + base, + {x: 0, y: parent.mapToItem(base, 0, 0).y}, + catalog.i18nc("@tooltip", "The material in this extruder.") + ); + } + else + { + base.hideTooltip(); + } + } + } } Label //Variant name. { + id: variantName text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null) ? connectedPrinter.hotendIds[index] : "" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width + + MouseArea //For tooltip. + { + id: variantNameTooltipArea + hoverEnabled: true + anchors.fill: parent + onHoveredChanged: + { + if (containsMouse) + { + base.showTooltip( + base, + {x: 0, y: parent.mapToItem(base, 0, 0).y}, + catalog.i18nc("@tooltip", "The nozzle inserted in this extruder.") + ); + } + else + { + base.hideTooltip(); + } + } + } } } }