mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Set focus on text field when slider handle is active - CURA-4432
This commit is contained in:
parent
a7368e1751
commit
ea01d6ad01
2 changed files with 11 additions and 7 deletions
|
@ -226,7 +226,7 @@ Item {
|
|||
maximumValue: sliderRoot.maximumValue
|
||||
value: sliderRoot.upperValue
|
||||
busy: UM.LayerView.busy
|
||||
setValue: sliderRoot.setUpperValue // connect callback functions
|
||||
setValue: upperHandle.setValue // connect callback functions
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ Item {
|
|||
maximumValue: sliderRoot.maximumValue
|
||||
value: sliderRoot.lowerValue
|
||||
busy: UM.LayerView.busy
|
||||
setValue: sliderRoot.setLowerValue // connect callback functions
|
||||
setValue: lowerHandle.setValue // connect callback functions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,13 +22,16 @@ UM.PointingRectangle {
|
|||
arrowSize: UM.Theme.getSize("default_arrow").width
|
||||
height: parent.height
|
||||
width: valueLabel.width + UM.Theme.getSize("default_margin").width
|
||||
visible: false
|
||||
|
||||
// make sure the text field is focussed when pressing the parent handle
|
||||
// needed to connect the key bindings when switching active handle
|
||||
onVisibleChanged: if (visible) valueLabel.forceActiveFocus()
|
||||
|
||||
color: UM.Theme.getColor("tool_panel_background")
|
||||
borderColor: UM.Theme.getColor("lining")
|
||||
borderWidth: UM.Theme.getSize("default_lining").width
|
||||
|
||||
visible: true
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: 50
|
||||
|
@ -53,6 +56,10 @@ UM.PointingRectangle {
|
|||
text: sliderLabelRoot.value + 1 // the current handle value, add 1 because layers is an array
|
||||
horizontalAlignment: TextInput.AlignRight
|
||||
|
||||
// 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.onDownPressed: sliderLabelRoot.setValue(sliderLabelRoot.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||
|
||||
style: TextFieldStyle {
|
||||
textColor: UM.Theme.getColor("setting_control_text")
|
||||
font: UM.Theme.getFont("default")
|
||||
|
@ -76,9 +83,6 @@ UM.PointingRectangle {
|
|||
bottom: 1
|
||||
top: sliderLabelRoot.maximumValue + 1 // +1 because actual layers is an array
|
||||
}
|
||||
|
||||
Keys.onUpPressed: sliderLabelRoot.setValue(sliderLabelRoot.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||
Keys.onDownPressed: sliderLabelRoot.setValue(sliderLabelRoot.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue