Merge branch 'CURA-6854_align_layer_label_top_bottom' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2019-11-05 13:23:34 +01:00
commit cb7552a926
No known key found for this signature in database
GPG Key ID: 3710727397403C91
3 changed files with 26 additions and 37 deletions

View File

@ -155,27 +155,15 @@ Item
} }
onPositionChanged: parent.onHandleDragged() onPositionChanged: parent.onHandleDragged()
onPressed: sliderRoot.setActiveHandle(rangeHandle) onPressed:
}
SimulationSliderLabel
{ {
id: rangleHandleLabel sliderRoot.setActiveHandle(rangeHandle)
sliderRoot.forceActiveFocus()
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
x: parent.x - width - UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
target: Qt.point(sliderRoot.width, y + height / 2)
visible: sliderRoot.activeHandle == parent
// custom properties
maximumValue: sliderRoot.maximumValue
value: sliderRoot.upperValue
busy: UM.SimulationView.busy
setValue: rangeHandle.setValueManually // connect callback functions
} }
} }
}
onHeightChanged : { onHeightChanged : {
// After a height change, the pixel-position of the lower handle is out of sync with the property value // After a height change, the pixel-position of the lower handle is out of sync with the property value
setLowerValue(lowerValue) setLowerValue(lowerValue)
@ -275,11 +263,12 @@ Item
{ {
id: upperHandleLabel id: upperHandleLabel
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height
x: parent.x - parent.width - width anchors.bottom: parent.top
anchors.verticalCenter: parent.verticalCenter anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height
target: Qt.point(sliderRoot.width, y + height / 2) anchors.horizontalCenter: parent.horizontalCenter
visible: sliderRoot.activeHandle == parent target: Qt.point(parent.width / 2, parent.top)
visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
// custom properties // custom properties
maximumValue: sliderRoot.maximumValue maximumValue: sliderRoot.maximumValue
@ -384,11 +373,12 @@ Item
{ {
id: lowerHandleLabel id: lowerHandleLabel
height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height
x: parent.x - parent.width - width anchors.top: parent.bottom
anchors.verticalCenter: parent.verticalCenter anchors.topMargin: UM.Theme.getSize("narrow_margin").height
target: Qt.point(sliderRoot.width + width, y + height / 2) anchors.horizontalCenter: parent.horizontalCenter
visible: sliderRoot.activeHandle == parent target: Qt.point(parent.width / 2, parent.bottom)
visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
// custom properties // custom properties
maximumValue: sliderRoot.maximumValue maximumValue: sliderRoot.maximumValue

View File

@ -20,9 +20,9 @@ UM.PointingRectangle {
property int startFrom: 1 property int startFrom: 1
target: Qt.point(parent.width, y + height / 2) target: Qt.point(parent.width, y + height / 2)
arrowSize: UM.Theme.getSize("default_arrow").width arrowSize: UM.Theme.getSize("button_tooltip_arrow").height
height: parent.height height: parent.height
width: valueLabel.width + UM.Theme.getSize("default_margin").width width: valueLabel.width
visible: false visible: false
color: UM.Theme.getColor("tool_panel_background") color: UM.Theme.getColor("tool_panel_background")
@ -48,9 +48,9 @@ UM.PointingRectangle {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
width: ((maximumValue + 1).toString().length + 1) * 10 * screenScaleFactor width: ((maximumValue + 1).toString().length + 1) * 8 * screenScaleFactor
text: sliderLabelRoot.value + startFrom // the current handle value, add 1 because layers is an array text: sliderLabelRoot.value + startFrom // the current handle value, add 1 because layers is an array
horizontalAlignment: TextInput.AlignRight horizontalAlignment: TextInput.AlignHCenter
// key bindings, work when label is currenctly focused (active handle in LayerSlider) // key bindings, work when label is currenctly focused (active handle in LayerSlider)
Keys.onUpPressed: sliderLabelRoot.setValue(sliderLabelRoot.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1)) Keys.onUpPressed: sliderLabelRoot.setValue(sliderLabelRoot.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
@ -58,7 +58,7 @@ UM.PointingRectangle {
style: TextFieldStyle { style: TextFieldStyle {
textColor: UM.Theme.getColor("setting_control_text") textColor: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("small")
background: Item { } background: Item { }
} }

View File

@ -194,9 +194,8 @@ Item
LayerSlider LayerSlider
{ {
property var preferredHeight: UM.Theme.getSize("slider_layerview_size").height property var preferredHeight: UM.Theme.getSize("slider_layerview_size").height
property double heightMargin: UM.Theme.getSize("default_margin").height property double heightMargin: UM.Theme.getSize("default_margin").height * 3 // extra margin to accomodate layer number tooltips
property double layerSliderSafeHeight: layerSliderSafeYMax - layerSliderSafeYMin property double layerSliderSafeHeight: layerSliderSafeYMax - layerSliderSafeYMin
//todo incorporate margins in safeHeight?
id: layerSlider id: layerSlider