Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2417

QDoubleSpinBox.setValue does not accept integers >= 2**31

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.6.0
    • 6.5.2
    • PySide
    • None
    • Windows
    • f275908ec (dev)

    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

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

          Activity

            People

              kleint Friedemann Kleint
              bers bers bers
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes