Initially I thought this to be a trivial task, but all the solutions I came up with have severe drawbacks.
The application I write is connected to machinery and all the inputs are evaluated as soon as a new value is entered. As soon as a checkbox or radiobutton is changed, the changes are immediately applied. There is no "OK" or "Submit" button, so everything has to be handled on the fly. Numeric inputs are done with spinboxes, and as soon as the value is changed, it is immediately applied. There are many such spinboxes for numerical values.
However, now I need a numeric input from 0 to about 200, but only values divisible by 5 are valid. I can set the step size of the spinbox to 5, and all works fine if the user scrolls with the mouse or presses the up or down buttons. However, once I use the keyboard, I can enter, for example, 12, and then if I spin up it will become 17. Of course, internally, the value used by the machinery was 10 and it changed to 15, but the user would see 12 and then 17.
One solution is to correct the input every time it was changed. But then the user cannot input the value 25 with the keyboard, because as soon as we type "2" it instantly becomes zero.
The other solution is to correct the input only when editing is finished. The UI elements do have the onEditingFinished() signal, but then a user could enter for example "12", and not do anything for a while, and the number displayed on the screen is "12" while the device works happily with "10". Only when other UI elements are selected, will the number jump from 12 to 10, possibly causing confusion.
Other alternatives have the problem of breaking design. There are many other number fields, so making this one completely different is not a nice solution. Using a slider or a combobox would be a last-ditch solution, but the input space is too big, 40 items in a combobox or other scrolling list can be frustrating.
Are there other alternatives which might have slipped my mind? How is such a thing commonly solved? I thought it is something very common, but now I can't find any examples of it in use.