Instead of having a seperate tooltip for the checkbox and the text area, the two have been combined into one tooltip.

The reason for this is that hovering the mouse between the checkbox and text was causing some strange behaviour where sometimes the tooltip would not appear.

The effect of the changes in RecommendedSupportSelector.qml are the same as RecommendedAdhesionSelector.qml. It just required a bit of refactoring to have the checkbox and the textlabel in the same component.

CURA-8849
This commit is contained in:
j.delarago 2022-06-21 11:59:03 +02:00
parent 4ee4a781f4
commit cde897ff1e
2 changed files with 218 additions and 210 deletions

View File

@ -28,7 +28,6 @@ Item
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
width: labelColumnWidth width: labelColumnWidth
iconSize: UM.Theme.getSize("medium_button_icon").width iconSize: UM.Theme.getSize("medium_button_icon").width
tooltipText: catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")
} }
Item Item
@ -48,8 +47,6 @@ Item
id: enableAdhesionCheckBox id: enableAdhesionCheckBox
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
property alias _hovered: adhesionMouseArea.containsMouse
//: Setting enable printing build-plate adhesion helper checkbox //: Setting enable printing build-plate adhesion helper checkbox
enabled: recommendedPrintSetup.settingsEnabled enabled: recommendedPrintSetup.settingsEnabled
@ -61,21 +58,24 @@ Item
id: adhesionMouseArea id: adhesionMouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
// propagateComposedEvents used on adhesionTooltipMouseArea does not work with Controls Components.
onClicked: // It only works with other MouseAreas, so this is required
{ onClicked: curaRecommendedMode.setAdhesion(!parent.checked)
curaRecommendedMode.setAdhesion(!parent.checked) }
}
} }
onEntered: MouseArea
{ {
base.showTooltip(enableAdhesionCheckBox, Qt.point(-enableAdhesionContainer.x - UM.Theme.getSize("thick_margin").width, 0), id: adhesionTooltipMouseArea
anchors.fill: parent
propagateComposedEvents: true
hoverEnabled: true
onEntered:base.showTooltip(enableAdhesionCheckBox, Qt.point(-enableAdhesionContainer.x - UM.Theme.getSize("thick_margin").width, 0),
catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")); catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards."));
}
onExited: base.hideTooltip() onExited: base.hideTooltip()
} }
}
}
UM.SettingPropertyProvider UM.SettingPropertyProvider
{ {

View File

@ -18,10 +18,24 @@ Item
property real labelColumnWidth: Math.round(width / 3) property real labelColumnWidth: Math.round(width / 3)
Item
{
id: enableSupportContainer
height: enableSupportCheckBox
width: childrenRect.width
anchors
{
left: parent.left
top: parent.top
bottom: parent.bottom
rightMargin: UM.Theme.getSize("thick_margin").width
verticalCenter: parent.verticalCenter
}
Cura.IconWithText Cura.IconWithText
{ {
id: enableSupportRowTitle id: enableSupportRowTitle
anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
visible: enableSupportCheckBox.visible visible: enableSupportCheckBox.visible
source: UM.Theme.getIcon("Support") source: UM.Theme.getIcon("Support")
@ -32,22 +46,11 @@ Item
tooltipText: catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.") tooltipText: catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing.")
} }
Item
{
id: enableSupportContainer
height: enableSupportCheckBox.height
anchors
{
left: enableSupportRowTitle.right
right: parent.right
verticalCenter: enableSupportRowTitle.verticalCenter
}
UM.CheckBox UM.CheckBox
{ {
id: enableSupportCheckBox id: enableSupportCheckBox
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: enableSupportRowTitle.right
property alias _hovered: enableSupportMouseArea.containsMouse property alias _hovered: enableSupportMouseArea.containsMouse
@ -61,14 +64,20 @@ Item
id: enableSupportMouseArea id: enableSupportMouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
// propagateComposedEvents used on supportToolTipMouseArea does not work with Controls Components.
// It only works with other MouseAreas, so this is required
onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True")
onEntered:
{
base.showTooltip(enableSupportCheckBox, Qt.point(-enableSupportContainer.x - UM.Theme.getSize("thick_margin").width, 0),
catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing."))
} }
}
MouseArea
{
id: supportToolTipMouseArea
anchors.fill: parent
propagateComposedEvents: true
hoverEnabled: true
onEntered: base.showTooltip(enableSupportContainer, Qt.point(-enableSupportContainer.x - UM.Theme.getSize("thick_margin").width, 0),
catalog.i18nc("@label", "Generate structures to support parts of the model which have overhangs. Without these structures, such parts would collapse during printing."))
onExited: base.hideTooltip() onExited: base.hideTooltip()
} }
} }
@ -80,9 +89,9 @@ Item
height: UM.Theme.getSize("print_setup_big_item").height height: UM.Theme.getSize("print_setup_big_item").height
anchors anchors
{ {
left: enableSupportCheckBox.right left: enableSupportContainer.right
right: parent.right right: parent.right
leftMargin: UM.Theme.getSize("thick_margin").width leftMargin: UM.Theme.getSize("default_margin").width
rightMargin: UM.Theme.getSize("thick_margin").width rightMargin: UM.Theme.getSize("thick_margin").width
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
@ -290,7 +299,6 @@ Item
} }
} }
} }
}
property var extruderModel: CuraApplication.getExtrudersModel() property var extruderModel: CuraApplication.getExtrudersModel()