mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 10:47:49 -06:00
Simplify tooltip handling for settings
Rather than use three different signals, use a single showTooltip signal with a text property. This makes it possible to show any tooltip from within a setting item.
This commit is contained in:
parent
2abb9a47c1
commit
b7fd97737c
3 changed files with 8 additions and 5 deletions
|
@ -13,7 +13,7 @@ Button {
|
||||||
|
|
||||||
style: UM.Theme.styles.sidebar_category;
|
style: UM.Theme.styles.sidebar_category;
|
||||||
|
|
||||||
signal showTooltip();
|
signal showTooltip(string text);
|
||||||
signal hideTooltip();
|
signal hideTooltip();
|
||||||
signal contextMenuRequested()
|
signal contextMenuRequested()
|
||||||
|
|
||||||
|
@ -69,11 +69,13 @@ Button {
|
||||||
iconSource: UM.Theme.getIcon("notice")
|
iconSource: UM.Theme.getIcon("notice")
|
||||||
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
base.showTooltip()
|
base.showTooltip(catalog.i18nc("@label", "This setting is normally calculated, but it currently has an absolute value set.\n\nClick to restore the calculated value."))
|
||||||
}
|
}
|
||||||
|
|
||||||
onExited: {
|
onExited: {
|
||||||
base.hideTooltip();
|
base.hideTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ Item {
|
||||||
property alias contents: controlContainer.children
|
property alias contents: controlContainer.children
|
||||||
|
|
||||||
signal contextMenuRequested()
|
signal contextMenuRequested()
|
||||||
signal showTooltip(var position);
|
signal showTooltip(string text);
|
||||||
signal hideTooltip();
|
signal hideTooltip();
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
|
@ -49,7 +49,7 @@ Item {
|
||||||
interval: 500;
|
interval: 500;
|
||||||
repeat: false;
|
repeat: false;
|
||||||
|
|
||||||
onTriggered: base.showTooltip({ x: mouse.mouseX, y: mouse.mouseY });
|
onTriggered: base.showTooltip(definition.description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ ScrollView
|
||||||
{
|
{
|
||||||
target: item
|
target: item
|
||||||
onContextMenuRequested: { contextMenu.key = model.key; contextMenu.popup() }
|
onContextMenuRequested: { contextMenu.key = model.key; contextMenu.popup() }
|
||||||
onShowTooltip: base.showTooltip(delegate, position, model.description)
|
onShowTooltip: base.showTooltip(delegate, { x: 0, y: delegate.height / 2 }, text)
|
||||||
|
onHideTooltip: base.hideTooltip()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue