Nest all controls inside the mousearea of SettingItem

This makes hover events work properly without all the hassle
This commit is contained in:
Arjen Hiemstra 2016-05-16 18:16:08 +02:00
parent f5e97c5001
commit 3531e4c3e8

View File

@ -16,7 +16,7 @@ Item {
height: UM.Theme.getSize("section").height;
property alias contents: controlContainer.children;
property bool hovered: false
property alias hovered: mouse.containsMouse
signal contextMenuRequested()
signal showTooltip(string text);
@ -52,7 +52,6 @@ Item {
onTriggered: base.showTooltip(definition.description);
}
}
Label
{
@ -90,7 +89,7 @@ Item {
{
id: revertButton;
// visible: base.overridden && base.is_enabled
visible: propertyProvider.properties.state == "InstanceState.User"
height: parent.height;
width: height;
@ -108,16 +107,7 @@ Item {
}
onEntered: base.showTooltip(catalog.i18nc("@label", "This setting has a value that is different from the profile.\n\nClick to restore the value of the profile."))
onExited:
{
if(controlContainer.item && controlContainer.item.hovered)
{
return;
}
base.hovered = false;
base.hideTooltip();
}
onExited: base.showTooltip(definition.description);
}
UM.SimpleButton
@ -125,7 +115,9 @@ Item {
// This button shows when the setting has an inherited function, but is overriden by profile.
id: inheritButton;
// visible: has_profile_value && base.has_inherit_function && base.is_enabled
//visible: has_profile_value && base.has_inherit_function && base.is_enabled
visible: propertyProvider.properties.state == "InstanceState.User"
height: parent.height;
width: height;
@ -142,15 +134,7 @@ Item {
iconSource: UM.Theme.getIcon("notice");
onEntered: 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: {
if(controlContainer.item && controlContainer.item.hovered) {
return;
}
base.hovered = false;
base.hideTooltip();
}
onExited: base.showTooltip(definition.description);
}
}
@ -165,6 +149,7 @@ Item {
width: UM.Theme.getSize("setting_control").width;
height: UM.Theme.getSize("setting_control").height
}
}
UM.I18nCatalog { id: catalog; name: "cura" }
}