python-qt-tools / pyside6-stubs Goto Github PK
View Code? Open in Web Editor NEWStubs for Qt6 for Python/PySide6
License: GNU Lesser General Public License v2.1
Stubs for Qt6 for Python/PySide6
License: GNU Lesser General Public License v2.1
There is a plan for updating stubs for 6.5.* branch?
Types for many basic things like Qt.Horizontal
seem to be missing.
Here is a bash sequence showing a simple example. In sequence it shows:
$ python --version
Python 3.11.8
$ pip freeze
mypy==1.9.0
mypy-extensions==1.0.0
PySide6==6.6.3
PySide6_Addons==6.6.3
PySide6_Essentials==6.6.3
shiboken6==6.6.3
typing_extensions==4.10.0
$ cat ./bugdemo.py
from PySide6.QtWidgets import QGraphicsView
from PySide6.QtCore import Qt
Qt.Horizontal
Qt.Vertical
QGraphicsView.ScrollHandDrag
$ mypy ./bugdemo.py
/home/russ/venvs/pyside6/lib/python3.11/site-packages/PySide6/QtCore.pyi:5858: error: invalid syntax [syntax]
Found 1 error in 1 file (errors prevented further checking)
$ # pyside6 default stubs are completely broken!!?
$ pip install pyside6-stubs > /dev/null
$ mypy ./bugdemo.py
bugdemo.py:4: error: "type[Qt]" has no attribute "Horizontal" [attr-defined]
bugdemo.py:5: error: "type[Qt]" has no attribute "Vertical" [attr-defined]
bugdemo.py:6: error: "type[QGraphicsView]" has no attribute "ScrollHandDrag" [attr-defined]
Found 3 errors in 1 file (checked 1 source file)
$ # pyside6-stubs are missing basics like Qt.Horizontal
$ pip uninstall pyside6-stubs -y > /dev/null
$ pip install IceSpringPySideStubs-PySide6
Collecting IceSpringPySideStubs-PySide6
Using cached IceSpringPySideStubs_PySide6-1.3.1-py3-none-any.whl.metadata (14 kB)
Using cached IceSpringPySideStubs_PySide6-1.3.1-py3-none-any.whl (3.7 MB)
Installing collected packages: IceSpringPySideStubs-PySide6
Successfully installed IceSpringPySideStubs-PySide6-1.3.1
$ mypy ./bugdemo.py
Success: no issues found in 1 source file
The variables that correspond to Public Variables of the C++ implementation don't have type annotations.
One example would be the QStyleOption
class:
The C++ doc: https://doc.qt.io/qt-6/qstyleoption.html#public-variables
The PySides6 doc: https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QStyleOption.html#PySide6.QtWidgets.PySide6.QtWidgets.QStyleOption.version
Stubs: https://github.com/python-qt-tools/PySide6-stubs/blob/main/PySide6-stubs/QtWidgets.pyi#L7038-L7086
But other classes seem to miss these variables as well, e.g., QStyleHintReturnVariant
, PixmapFragment
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.