Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99268

Make SpinBox more flexible to allow double precision values



    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.2.2
    • Quick: Controls 2
    • None



      The current SpinBox component is insufficiently flexible to allow dor a double precision value. Note that the example visualizing a double precision increments the major part, not the precision part.

      Say you want to increment in step sizes of 0.01. A very real case in the application i work on right now. That's not possible in the current SpinBox.

      The way i resolved it is essentially manipulating max value to be sufficiently large enough to contain all the possible steps as whole int steps. This does mean the value get a lot higher then the actual real value.

      A fix for the SpinBox component would be to implement the following:

      • stepSize needs to change to a real value
      • from needs to change to a real value
      • to needs to change to a real value
      • value needs to change to a real value
      • Add a property named "precision" indicating how much of the precision to be visible. So a precision of "3" would show a real value of "5.432". If the stepsize here is "0.001" then the value would be incremented/decremented in steps of "0.001".

      Note that this is an absolute necessity for applications that, for example, control hardware. Too big immediate changes there could lead to hardware failure. This is a very typical example usecase where Qt was amazing in the past.

      It frankly baffles me that in the years since controls v2 a feature like this is never added. It was there in controls v1 and is required to be there in v2 too.


        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              mitch_curtis Mitch Curtis
              markg85 Mark
              0 Vote for this issue
              3 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes