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

Incorrect return type annotation for QInputDialog.getInt

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • 6.4.0
    • PySide
    • None
    • f30d4fe3ba (pyside/pyside-setup/dev) f30d4fe3ba (pyside/tqtc-pyside-setup/dev) 514373ebfe (pyside/pyside-setup/6.4.0) 514373ebfe (pyside/tqtc-pyside-setup/6.4.0) a5fa628cda (pyside/pyside-setup/6.4) a5fa628cda (pyside/tqtc-pyside-setup/6.4)

    Description

      As far as I can tell, both PySide 6.3.2 and 6.4.0 return a tuple from QInputDialog.getInt:

      > python -c "from PySide6.QtWidgets import QApplication, QInputDialog; QApplication(); print(QInputDialog.getInt(None, 'Title', 'Prompt'))"
      (0, False)

       

      In 6.3.2, type stubs where correct:

           def getInt(parent: PySide6.QtWidgets.QWidget, title: str, label: str, value: int, minValue: int = ..., maxValue: int = ..., step: int = ..., flags: PySide6.QtCore.Qt.WindowFlags = ...) -> Tuple[int, bool]: ...   

       
      Now, in 6.4.0, type stubs are incorrect (in the return type - the added ... default value seems correct):

          def getInt(parent: PySide6.QtWidgets.QWidget, title: str, label: str, value: int = ..., minValue: int = ..., maxValue: int = ..., step: int = ..., flags: PySide6.QtCore.Qt.WindowType = ...) -> int: ...  

       
      Interestingly, the documentation has been incorrectly saying that getInt returns an int for a while,
      https://web.archive.org/web/20220526102118/https://doc.qt.io/qtforpython/PySide6/QtWidgets/QInputDialog.html#PySide6.QtWidgets.PySide6.QtWidgets.QInputDialog.getInt
      and still does:
      https://doc.qt.io/qtforpython/PySide6/QtWidgets/QInputDialog.html#PySide6.QtWidgets.PySide6.QtWidgets.QInputDialog.getInt

      Attachments

        For Gerrit Dashboard: PYSIDE-2081
        # Subject Branch Project Status CR V

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            bers bers bers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes