Author : Philippe Fremy
This package provides improved typing stubs for Qt6 for Python/PySide6. The
official stubs delivered along with PySide6 are reasonably good but may be incomplete in a few areas
for proper typing verification with mypy.
- add typing information for all properties
- add conversion from
QByteArraytobytes - add construction of
QByteArrayfrom length and string - fix
QFileDialog.getOpen*()methods to acceptNoneas parent argument - fix
QLineEdit.setText()to acceptNone - fix
QTreeWidget.setItemWidget()andQListWidget.setItemWidget()to acceptNoneas a widget argument - fix
QProgressDialog.setCancelButton()acceptingNone - support all
QSizeandQSizeFoperations - fix
QTabBar.setButtonWidget()to acceptNoneas a widget argument - fix
QTreeWidget.topLevelItem()returning possiblyNone - fix
QTreeWidgetItemcomparison with< - fix
QMessageBox.warning,information,critical,question,about,aboutQtto acceptNoneas parent argument - fix
qVersion()returns string, not bytes - fix
qDebug(),qWarning(),qCritical(),qFatal(),SIGNAL(),SLOT()to accept string, not bytes - fix
Signal.connect(),Signal.disconnect(),QObject.connect()andQObject.disconnect()to acceptstrinstead ofbool, and to returnboolon disconnect. - fix incorrect signature of
QCoreApplication.translate() - improve signature of operations on
QPolygon - fix
QObject.findChildren()andQObject.findChild()to detect that type being returned is the one being searched
See CHANGELOG.md for full details.
This effort was inspired by the PyQt5-stubs and PySide2-stubs project.
Please note that this work is far from complete. Don't hesitate to report problems or propose improvements.
As a derived work from PySide6, the stubs are delivered under the LGPL v2.1 . See file LICENSE for more details.
Install from pypi:
$ pip install PySide6-stubs
If you want to install the stable development version from the Git repository:
$ pip install git+https://github.com/python-qt-tools/PySide6-stubs
If you notice incorrect or missing typing information (mypy reports errors eventhough your code is correct), please report it here with the following steps:
- create an issue showing your problem
- even better, create a PR to fix the problem. See [CONTRIBUTING.md] for details.
You can also report typing issues directly to PySide here: https://bugreports.qt.io/secure/CreateIssue!default.jspa
We track the list of issues reported to Qt here: [PYSIDE6_ISSUES.md]