qt5base-lts/tests/auto/widgets
Harald Nordgren 97e40a5409 Allow adaptive decimal stepping for QSpinBox and QDoubleSpinBox
Adds the feature of adaptive decimal step sizes for the QSpinBox and
QDoubleSpinBox. By performing a calculation in
QAbstractSpinBox::stepBy() we continuously set the step size one power
of ten below the current value.

So when the value is 1100, the step is set to 100, so stepping up once
increases it to 1200. For 1200 stepping up takes it to 1300. For
negative values stepping down from -1100 goes to -1200.

It also works for all decimal values. 0.041 is increased to 0.042 by
stepping once, and so on.

The step direction is taken into account to handle edges cases, so that
stepping down from 100 takes the value to 99 instead of 90. Thus, a
step up followed by a step down -- or vice versa -- lands on the
starting value; 99 -> 100 -> 99.

Setting this property effectively disregards singleStep, but preserves
its value so that it takes effect again when adaptive decimal step is
disabled.

Adaptive decimal step allows values to be easily set to reasonable
levels. If the spin box value is 12000, changing to 13000 often makes
more sense than to 12001. The feature is turned off be default, when
single stepping is desired.

The accelerated property allows values to be changed quickly, as well,
but it is imprecise. Holding down the button makes it hard to land on
an even thousand, like 12000 or 13000. Often you end up somewhere
nearby and would need a second adjustment to get to an even hundred or
thousand.

[ChangeLog][QtWidgets] Add option of adaptive decimal step size for
QSpinBox and QDoubleSpinBox.

Change-Id: I9f286479b821e240c8ea05c238932fc128c582bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-03-22 21:37:45 +00:00
..
dialogs Don’t show file dialog before calling selectFile() 2018-03-19 14:39:33 +00:00
effects Revert "Set sharedPainter correctly for QGraphicsEffect" 2018-03-14 12:37:53 +00:00
graphicsview Stabilize tst_qgraphicsitem and tst_qgraphicsview 2018-03-19 14:38:23 +00:00
itemviews Fix tst_QTreeView - setSortingEnabledChild 2018-03-18 09:29:03 +00:00
kernel Blacklist childEvents on macOS CI again 2018-03-19 14:38:06 +00:00
styles Merge remote-tracking branch 'origin/5.9' into 5.11 2018-02-14 12:51:24 +01:00
util Merge remote-tracking branch 'origin/5.10' into dev 2017-11-23 09:36:03 +01:00
widgets Allow adaptive decimal stepping for QSpinBox and QDoubleSpinBox 2018-03-22 21:37:45 +00:00
widgets.pro Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00