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

Importing `PySide6.QtCore` causes TypeErrors everywhere

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.7.0
    • PySide
    • None
    • Windows

    Description

      from PySide6.QtCore import *
      from PySide6.QtWidgets import * 
      import sys
      
      app = QApplication([]) 
      window = QMainWindow() 
      central_widget = QFrame() 
      window.setCentralWidget(central_widget) # here
      sys.exit(app.exec())
      

      The above code throws this error:

      TypeError: 'PySide6.QtWidgets.QMainWindow.setCentralWidget' called with wrong argument types:
        PySide6.QtWidgets.QMainWindow.setCentralWidget(QFrame)
      Supported signatures:
        PySide6.QtWidgets.QMainWindow.setCentralWidget(PySide6.QtWidgets.QWidget)
      

      But the following code will run with no errors:

      # from PySide6.QtCore import *
      from PySide6.QtWidgets import *
      import sys
      
      app = QApplication([])
      window = QMainWindow()
      central_widget = QFrame()
      window.setCentralWidget(central_widget)
      sys.exit(app.exec())
      

      Similarly this would error with QtCore imported:

      from PySide6.QtCore import *
      from PySide6.QtWidgets import *
      import sys
      
      app = QApplication([])
      window = QMainWindow()
      layout = QGridLayout()
      window.setLayout(layout) # here
      sys.exit(app.exec())
      

      the error being:

      TypeError: 'PySide6.QtWidgets.QWidget.setLayout' called with wrong argument types:
        PySide6.QtWidgets.QWidget.setLayout(QGridLayout)
      Supported signatures:
        PySide6.QtWidgets.QWidget.setLayout(PySide6.QtWidgets.QLayout)
      

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes