Fix foldout of the layerview panel being too short or too long

CURA-5829
This commit is contained in:
Jaime van Kessel 2018-11-07 16:30:52 +01:00
parent 2c59419dbb
commit f15d03d48c

View File

@ -19,7 +19,7 @@ Rectangle
width: UM.Theme.getSize("layerview_menu_size").width width: UM.Theme.getSize("layerview_menu_size").width
height: viewSettings.collapsed ? layerViewTypesLabel.height + 2 * UM.Theme.getSize("default_margin").height : childrenRect.height height: viewSettings.collapsed ? layerViewTypesLabel.height + 2 * UM.Theme.getSize("default_margin").height : childrenRect.height + 2 * UM.Theme.getSize("default_margin").height
Behavior on height { NumberAnimation { duration: 100 } } Behavior on height { NumberAnimation { duration: 100 } }
@ -469,83 +469,91 @@ Rectangle
} }
} }
// Gradient colors for feedrate Item
Rectangle {
{ // In QML 5.9 can be changed by LinearGradient // Another hack on top of the rotation of the gradient.
// Invert values because then the bar is rotated 90 degrees // Since we set the side of the panel to use childrenRect (and that uses the un-rotated height), add this
id: feedrateGradient // wrapper item with the correct width & height so it doesn't get confused.
visible: viewSettings.show_feedrate_gradient width: parent.width
anchors.left: parent.right height: feedrateGradient.visible || thicknessGradient.visible ? Math.round(UM.Theme.getSize("layerview_row").height * 1.5) : 0
height: parent.width // Gradient colors for feedrate
width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5) Rectangle
border.width: UM.Theme.getSize("default_lining").width { // In QML 5.9 can be changed by LinearGradient
border.color: UM.Theme.getColor("lining") // Invert values because then the bar is rotated 90 degrees
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90} id: feedrateGradient
gradient: Gradient visible: viewSettings.show_feedrate_gradient
{ anchors.left: parent.right
GradientStop height: parent.width
width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5)
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90}
gradient: Gradient
{ {
position: 0.000 GradientStop
color: Qt.rgba(1, 0.5, 0, 1) {
} position: 0.000
GradientStop color: Qt.rgba(1, 0.5, 0, 1)
{ }
position: 0.625 GradientStop
color: Qt.rgba(0.375, 0.5, 0, 1) {
} position: 0.625
GradientStop color: Qt.rgba(0.375, 0.5, 0, 1)
{ }
position: 0.75 GradientStop
color: Qt.rgba(0.25, 1, 0, 1) {
} position: 0.75
GradientStop color: Qt.rgba(0.25, 1, 0, 1)
{ }
position: 1.0 GradientStop
color: Qt.rgba(0, 0, 1, 1) {
position: 1.0
color: Qt.rgba(0, 0, 1, 1)
}
} }
} }
}
// Gradient colors for layer thickness (similar to parula colormap) // Gradient colors for layer thickness (similar to parula colormap)
Rectangle // In QML 5.9 can be changed by LinearGradient Rectangle // In QML 5.9 can be changed by LinearGradient
{
// Invert values because then the bar is rotated 90 degrees
id: thicknessGradient
visible: viewSettings.show_thickness_gradient
anchors.left: parent.right
height: parent.width
width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5)
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90}
gradient: Gradient
{ {
GradientStop // Invert values because then the bar is rotated 90 degrees
id: thicknessGradient
visible: viewSettings.show_thickness_gradient
anchors.left: parent.right
height: parent.width
width: Math.round(UM.Theme.getSize("layerview_row").height * 1.5)
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
transform: Rotation {origin.x: 0; origin.y: 0; angle: 90}
gradient: Gradient
{ {
position: 0.000 GradientStop
color: Qt.rgba(1, 1, 0, 1) {
} position: 0.000
GradientStop color: Qt.rgba(1, 1, 0, 1)
{ }
position: 0.25 GradientStop
color: Qt.rgba(1, 0.75, 0.25, 1) {
} position: 0.25
GradientStop color: Qt.rgba(1, 0.75, 0.25, 1)
{ }
position: 0.5 GradientStop
color: Qt.rgba(0, 0.75, 0.5, 1) {
} position: 0.5
GradientStop color: Qt.rgba(0, 0.75, 0.5, 1)
{ }
position: 0.75 GradientStop
color: Qt.rgba(0, 0.375, 0.75, 1) {
} position: 0.75
GradientStop color: Qt.rgba(0, 0.375, 0.75, 1)
{ }
position: 1.0 GradientStop
color: Qt.rgba(0, 0, 0.5, 1) {
position: 1.0
color: Qt.rgba(0, 0, 0.5, 1)
}
} }
} }
} }