Description
QDoubleSpinBox.setValue accepts int and double values (which makes sense as long as the int can be converted to a double without loss, which should be true up to 2**52-1).
However, QDoubleSpinBox.setValue accepts values only up to 2*31-1:
import warnings from PySide6.QtWidgets import QApplication, QDoubleSpinBox, QSpinBox warnings.filterwarnings("ignore") app = QApplication() int_box = QSpinBox() int_box.setValue(2**31 - 1) # pass try: int_box.setValue(2**31) # fail except OverflowError: print("expected overflow: QSpinBox uses signed int32") double_box = QDoubleSpinBox() double_box.setValue(2**31 - 1) # pass try: double_box.setValue(2**31) # fail except OverflowError: print("unexpected overflow: Q*Double*SpinBox shold *not* be using signed int32") double_box.setValue(2.0**31) # pass
I am happy there is a workaround in converting the value to float before setting it, but IMHO integers should be accepted without conversion.
Attachments
Issue Links
- relates to
-
PYSIDE-2652 QDoubleSpinBox.setValue does not accept integers >= 2**63
- Closed
For Gerrit Dashboard: PYSIDE-2417 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
497842,3 | Fix overflows when passing int to functions taking floats | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
497881,2 | Fix overflows when passing int to functions taking floats | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
497884,2 | Fix overflows when passing int to functions taking floats | tqtc/lts-6.2 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |