c++qtuser-interfaceqt-creatorqspinbox

How to set up QSpinbox increment bigger than +1?


In different areas of program i need to set different increment somewhere by +1 and somewehere by +2 or more. How to do this?


Solution

  • Use setSingleStep() method:

    This property holds the step value.

    When the user uses the arrows to change the spin box's value the value will be incremented/decremented by the amount of the singleStep. The default value is 1. Setting a singleStep value of less than 0 does nothing.

    spinBox->setSingleStep(2);
    

    http://qt-project.org/doc/qt-4.8/qspinbox.html#singleStep-prop