mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
Show Tooltip for the unavailable slider's area
CURA-5044
This commit is contained in:
parent
561b97c255
commit
160a59191b
1 changed files with 69 additions and 0 deletions
|
@ -243,6 +243,75 @@ Item
|
|||
anchors.top: parent.top
|
||||
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
|
||||
|
||||
// This Item is used only for tooltip, for slider area which is unavailable
|
||||
Item{
|
||||
|
||||
function showTooltip (showTooltip) {
|
||||
if(showTooltip){
|
||||
var content = catalog.i18nc("@tooltip","This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile")
|
||||
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content)
|
||||
}
|
||||
else
|
||||
base.hideTooltip();
|
||||
}
|
||||
|
||||
id: unavailableLineToolTip
|
||||
height: 20 // hovered area height
|
||||
z: parent.z + 1 // should be higher, otherwise the area can be hovered
|
||||
x: 0
|
||||
anchors.verticalCenter: qualitySlider.verticalCenter
|
||||
|
||||
Rectangle{
|
||||
id: leftArea
|
||||
width: {
|
||||
if(qualityModel.availableTotalTicks == 0)
|
||||
return 0
|
||||
|
||||
return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10
|
||||
}
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false
|
||||
onEntered: unavailableLineToolTip.showTooltip(true)
|
||||
onExited: unavailableLineToolTip.showTooltip(false)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id: rightArea
|
||||
width: {
|
||||
if(qualityModel.availableTotalTicks == 0)
|
||||
return 0
|
||||
|
||||
return qualityModel.qualitySliderMarginRight - 10
|
||||
}
|
||||
height: parent.height
|
||||
color: "transparent"
|
||||
x: {
|
||||
if(qualityModel.availableTotalTicks == 0){
|
||||
return 0
|
||||
}
|
||||
|
||||
var leftUnavailableArea = qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin
|
||||
var totalGap = qualityModel.qualitySliderStepWidth * (qualityModel.availableTotalTicks -1) + leftUnavailableArea + 10
|
||||
|
||||
return totalGap
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: Cura.SimpleModeSettingsManager.isProfileUserCreated == false
|
||||
onEntered: unavailableLineToolTip.showTooltip(true)
|
||||
onExited: unavailableLineToolTip.showTooltip(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw Unavailable line
|
||||
Rectangle
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue