diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml
index eb09326524..353c4df51a 100644
--- a/plugins/PrepareStage/PrepareMenu.qml
+++ b/plugins/PrepareStage/PrepareMenu.qml
@@ -10,6 +10,10 @@ Row
{
spacing: UM.Theme.getSize("default_margin").width
+ // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
+ signal showTooltip(Item item, point location, string text)
+ signal hideTooltip()
+
UM.I18nCatalog
{
id: catalog
@@ -18,12 +22,12 @@ Row
Button
{
- id: openFileButton;
- text: catalog.i18nc("@action:button", "Open File");
+ id: openFileButton
+ text: catalog.i18nc("@action:button", "Open File")
iconSource: UM.Theme.getIcon("load")
style: UM.Theme.styles.tool_button
tooltip: ""
- action: Cura.Actions.open;
+ action: Cura.Actions.open
}
Cura.MachineAndConfigurationSelector
@@ -38,5 +42,7 @@ Row
Cura.ProfileAndSettingComponent
{
width: UM.Theme.getSize("sidebar").width
+ onShowTooltip: parent.showTooltip(item, location, text)
+ onHideTooltip: parent.hideTooltip()
}
}
\ No newline at end of file
diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml
index 304f78e633..97cdc94d64 100644
--- a/resources/qml/Cura.qml
+++ b/resources/qml/Cura.qml
@@ -163,10 +163,16 @@ UM.MainWindow
}
height: 50
-
source: UM.Controller.activeStage.stageMenuComponent
}
+ Connections
+ {
+ target: stageMenu.item
+ onShowTooltip: base.showTooltip(item, location, text)
+ onHideTooltop: base.hideTooltip()
+ }
+
JobSpecs
{
id: jobSpecs
diff --git a/resources/qml/ProfileAndSettingComponent.qml b/resources/qml/ProfileAndSettingComponent.qml
index dbded90576..b367c1130f 100644
--- a/resources/qml/ProfileAndSettingComponent.qml
+++ b/resources/qml/ProfileAndSettingComponent.qml
@@ -28,6 +28,10 @@ Rectangle
color: UM.Theme.getColor("sidebar")
UM.I18nCatalog { id: catalog; name:"cura"}
+ // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
+ signal showTooltip(Item item, point location, string text)
+ signal hideTooltip()
+
Timer
{
id: tooltipDelayTimer
@@ -42,18 +46,6 @@ Rectangle
}
}
- function showTooltip(item, position, text)
- {
- tooltip.text = text;
- position = item.mapToItem(base, position.x - UM.Theme.getSize("default_arrow").width, position.y);
- tooltip.show(position);
- }
-
- function hideTooltip()
- {
- tooltip.hide();
- }
-
function strPadLeft(string, pad, length)
{
return (new Array(length + 1).join(pad) + string).slice(-length);
@@ -205,241 +197,19 @@ Rectangle
{
anchors.fill: parent
visible: currentModeIndex == 1
+ onShowTooltip: base.showTooltip(item, location, text)
+ onHideTooltip: base.hideTooltip()
}
SidebarSimple
{
anchors.fill: parent
visible: currentModeIndex != 1
+ onShowTooltip: base.showTooltip(item, location, text)
+ onHideTooltip: base.hideTooltip()
}
}
- /*Item
- {
- id: printSpecs
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
- anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height
- height: timeDetails.height + costSpec.height
- width: base.width - (saveButton.buttonRowWidth + UM.Theme.getSize("sidebar_margin").width)
-
- Label
- {
- id: timeDetails
- anchors.left: parent.left
- anchors.bottom: costSpec.top
- font: UM.Theme.getFont("large")
- color: UM.Theme.getColor("text_subtext")
- text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label Hours and minutes", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
- renderType: Text.NativeRendering
-
- MouseArea
- {
- id: timeDetailsMouseArea
- anchors.fill: parent
- hoverEnabled: true
-
- onEntered:
- {
- if(base.printDuration.valid && !base.printDuration.isTotalDurationZero)
- {
- // All the time information for the different features is achieved
- var print_time = PrintInformation.getFeaturePrintTimes();
- var total_seconds = parseInt(base.printDuration.getDisplayString(UM.DurationFormat.Seconds))
-
- // A message is created and displayed when the user hover the time label
- var tooltip_html = "%1
" + feature + ": | " + - "%1 | ".arg(print_time[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) + - "%1% | ".arg(Math.round(100 * parseInt(print_time[feature].getDisplayString(UM.DurationFormat.Seconds)) / total_seconds)) + - "