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

Type hints: QMessageBox.information misses default values

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • 6.9.0, 6.8.3
    • 6.8.2
    • Type hints
    • None
    • 315a7c85a (dev), 2a2e65417 (6.8)

    Description

      Essentially PYSIDE-2939 (Type hints: QMessageBox.warning misses default values for button0, button1) for QMessageBox.informatin. Example code runs fine yet mypy 1.14.1 errors:

      from PySide6.QtWidgets import QApplication, QMessageBox, QWidget
      
      QApplication()
      QMessageBox.warning(QWidget(), "", "")
      

      6.8.2

      def information(parent: PySide6.QtWidgets.QWidget, title: str, text: str,
         button0: PySide6.QtWidgets.QMessageBox.StandardButton, /, 
        button1: PySide6.QtWidgets.QMessageBox.StandardButton = ...) -> 
                PySide6.QtWidgets.QMessageBox.StandardButton: ...
      
          @staticmethod
          def question(parent: PySide6.QtWidgets.QWidget, title: str, text: str, /, 
            buttons: PySide6.QtWidgets.QMessageBox.StandardButton = ..., 
         defaultButton: PySide6.QtWidgets.QMessageBox.StandardButton = ...) -> 
                   PySide6.QtWidgets.QMessageBox.StandardButton: ...
      

      6.7.2

       
          @staticmethod
          def information(parent: PySide6.QtWidgets.QWidget, title: str, text: str,
          button0:  PySide6.QtWidgets.QMessageBox.StandardButton,
         button1: PySide6.QtWidgets.QMessageBox.StandardButton = ...) -> 
                        PySide6.QtWidgets.QMessageBox.StandardButton: ...
          @overload
          @staticmethod
          def information(parent: PySide6.QtWidgets.QWidget, title: str, text: str,
           buttons:  PySide6.QtWidgets.QMessageBox.StandardButton = ..., 
           defaultButton: PySide6.QtWidgets.QMessageBox.StandardButton = ...) ->
                    PySide6.QtWidgets.QMessageBox.StandardButton: ...
      

      from

          static StandardButton information(QWidget *parent, const QString &title,
               const QString &text, StandardButtons buttons = Ok,
               StandardButton defaultButton = NoButton);
      #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) // needed as long as we have int overloads
          inline static StandardButton information(QWidget *parent, const QString &title,
                                        const QString& text,
                                        StandardButton button0, StandardButton button1 = NoButton)
          { return information(parent, title, text, StandardButtons(button0), button1); }
      #endif
      
          static StandardButton question(QWidget *parent, const QString &title,
               const QString &text, StandardButtons buttons = StandardButtons(Yes | No),
               StandardButton defaultButton = NoButton);
      #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
          inline static int question(QWidget *parent, const QString &title,
                                     const QString& text,
                                     StandardButton button0, StandardButton button1)
          { return question(parent, title, text, StandardButtons(button0), button1); }
      #endif
      

      Attachments

        1. bug4.py
          0.1 kB
          bers bers
        2. pyside2997.py
          0.5 kB
          Friedemann Kleint

        Issue Links

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

          Activity

            People

              ctismer Christian Tismer
              bers bers bers
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes