What is the maximum and minimum values that QSpinBox supports in PySide6

20 Views Asked by At

What is the maximum and minimum values that QSpinBox supports?

For QDoubleSpinBox we can use float("inf") to set the maximum value and float("-inf") to set the minimum value.

box = QDoubleSpinBox()
box.setMinimum(float("-inf"))
box.setMaximum(float("inf"))

But For QSpinBox when I do

import sys
...
quantity = QSpinBox()
quantity.setMaximum(sys.maxsize)
...

It throws error :

 RuntimeWarning: libshiboken: Overflow: Value 9223372036854775807 exceeds limits of type  [signed] "i" (4bytes).
  quantity.setMaximum(sys.maxsize)
Traceback (most recent call last):
  File "/.../createWindow.py", line 180, in addButtonClicked
    quantity.setMaximum(sys.maxsize)
OverflowError

I understand that the value which is provided(sys.maxsize) is way to big and results in Overflow.

What is the maximum value and minimum value that I can provide to a QSpinBox?

0

There are 0 best solutions below