Skip to content

SpinBox: move onTextEdited to contentItem, check acceptableInput, implicit size based on max value, align left

Noah Davis requested to merge work/ndavis/spinbox-textfield into master

Updated imports (needed for onTextEdited stuff)


SpinBox: move onTextEdited to contentItem, check acceptableInput

Sometimes different behavior is needed and having the onTextEdited signal handler outside of the contentItem prevents customization.

Checking acceptableInput before updating to make the behavior more predictable. As it was, if the min value was 20, the max value 200 and you wanted to manually enter 100, you would instead get auto completed to 20 when you pressed 1 and then you'd have 200 after typing the first 0 instead of "10". The final 0 would be ignored because you'd already be at the max value.

Also using text.length > 0 instead of using type coercion.


Used Qt.styleHints.useHoverEffects for hoverEnabled


SpinBox: Use implicit size based on the max value

Don't use 48 as minimum implicit size. It makes it harder to use spinboxes that are only as large as they need to be.

Use inset and implicit background size in implicit size.


SpinBox: AlignLeft by default

Spinboxes are usually aligned left by default in desktop apps.

@teams/vdg

Merge request reports