├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── NOTES.md ├── PYSIDE6_ISSUES.md ├── PySide6-stubs ├── Qt3DAnimation.pyi ├── Qt3DCore.pyi ├── Qt3DExtras.pyi ├── Qt3DInput.pyi ├── Qt3DLogic.pyi ├── Qt3DRender.pyi ├── QtAxContainer.pyi ├── QtBluetooth.pyi ├── QtCharts.pyi ├── QtConcurrent.pyi ├── QtCore.pyi ├── QtDBus.pyi ├── QtDataVisualization.pyi ├── QtDesigner.pyi ├── QtGraphs.pyi ├── QtGui.pyi ├── QtHelp.pyi ├── QtHttpServer.pyi ├── QtLocation.pyi ├── QtMultimedia.pyi ├── QtMultimediaWidgets.pyi ├── QtNetwork.pyi ├── QtNetworkAuth.pyi ├── QtNfc.pyi ├── QtOpenGL.pyi ├── QtOpenGLWidgets.pyi ├── QtPdf.pyi ├── QtPdfWidgets.pyi ├── QtPositioning.pyi ├── QtPrintSupport.pyi ├── QtQml.pyi ├── QtQuick.pyi ├── QtQuick3D.pyi ├── QtQuickControls2.pyi ├── QtQuickTest.pyi ├── QtQuickWidgets.pyi ├── QtRemoteObjects.pyi ├── QtScxml.pyi ├── QtSensors.pyi ├── QtSerialBus.pyi ├── QtSerialPort.pyi ├── QtSpatialAudio.pyi ├── QtSql.pyi ├── QtStateMachine.pyi ├── QtSvg.pyi ├── QtSvgWidgets.pyi ├── QtTest.pyi ├── QtTextToSpeech.pyi ├── QtUiTools.pyi ├── QtWebChannel.pyi ├── QtWebEngineCore.pyi ├── QtWebEngineQuick.pyi ├── QtWebEngineWidgets.pyi ├── QtWebSockets.pyi ├── QtWidgets.pyi ├── QtXml.pyi ├── __feature__.pyi └── __init__.pyi ├── README.md ├── TODO.txt ├── mypy.ini ├── pyproject.toml ├── release_process.md ├── requirements-dev.txt ├── scripts ├── README_scripts.md ├── __init__.py ├── apply_public_variables.py ├── apply_signals.py ├── class-signals.json ├── collect_public_variables.py ├── collect_signals.py ├── public-variables.json └── utils.py ├── setup.cfg ├── shiboken6-stubs ├── Shiboken.pyi ├── __init__.pyi └── shiboken6.pyi ├── tests ├── QState.py ├── alignment_flag.py ├── qaction.py ├── qapplication.py ├── qbytearray.py ├── qcolumnview.py ├── qcoreapplication.py ├── qdatetime.py ├── qdbusabstractinterface.py ├── qdialog.py ├── qdialogbuttonbox.py ├── qfiledialog.py ├── qflag.py ├── qguiapplication.py ├── qheaderview.py ├── qicon.py ├── qinputdialog.py ├── qlabel.py ├── qlayout.py ├── qlineedit.py ├── qlistview.py ├── qlistwidget.py ├── qmenu.py ├── qmessagebox.py ├── qmessagebox2.py ├── qmodelindex.py ├── qobject.py ├── qpainter.py ├── qpixmap.py ├── qpolygon.py ├── qprocess.py ├── qprogressdialog.py ├── qquickitem.py ├── qsize.py ├── qstyleoption.py ├── qtabbar.py ├── qtableview.py ├── qtcore_functions.py ├── qtimer.py ├── qtreeview.py ├── qtreewidget.py ├── qtreewidgetitem.py ├── qwidget.py ├── qwindow.py ├── signal_slot.py ├── slot.py └── test_examples_here.py ├── update_latest_pyside6.py └── version.py /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Continuous Integration 3 | 4 | on: 5 | push: 6 | branches: [ main ] 7 | pull_request: 8 | branches: [ main ] 9 | 10 | jobs: 11 | test-windows-python: 12 | 13 | runs-on: windows-latest 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | include: 18 | # oldest version of pyhon / mypy which works 19 | - python-version: "3.9" 20 | mypy-version: "1.1.1" 21 | pyside6-version: "6.6.2" 22 | 23 | # latest version of everything 24 | - python-version: "3.12" 25 | mypy-version: "1.15" 26 | pyside6-version: "6.8.2.1" 27 | 28 | steps: 29 | - uses: actions/checkout@v3 30 | 31 | - name: Set up Python ${{ matrix.python-version }} 32 | uses: actions/setup-python@v3 33 | with: 34 | python-version: ${{ matrix.python-version }} 35 | 36 | - name: Install dependencies 37 | run: | 38 | python -m pip install --upgrade pip 39 | python -m pip install setuptools==75.8.0 40 | python -m pip install pyside6==${{ matrix.pyside6-version }} pytest mypy==${{ matrix.mypy-version }} 41 | pip install -e . --config-settings editable_mode=compat 42 | pip list 43 | 44 | - name: run tests 45 | run: | 46 | pytest -v 47 | 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env* 2 | /dist/ 3 | /build/ 4 | /PySide6_stubs.egg-info 5 | .mypy_cache 6 | incoming 7 | .idea 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | (in development) 4 | ================ 5 | * `QModelIndex.constInternalPointer()` should be `Any` 6 | * `QDBusConnection.internalPointer()` and `QDBusConnection.constInternalPointer()` should be `Any` 7 | * `QInputDialog.getText()`, `getInt()`, `getFloat()`, `getMultiLineText()`, `getItem()` accept `None`as parent argument 8 | 9 | 10 | Version 6.7.3.0 11 | ============== 12 | * Synchronize stubs with upstream PySide6 6.7.3 13 | * add typing information for all properties 14 | * Allow `QGridLayout`, `QHBoxLayout` and `QVBoxLayout` to accept parent as None 15 | * Make `QtCore.Slot()` verify its arguments and return value 16 | * fix `QObject.inherits()` type signature to accept string 17 | * fix `QStateMachine.assignProperty()` type signature 18 | * fix `QObject.findChildren()` and `QObject.findChild()` to detect that type being returned is the one being searched 19 | * fix many methods in QtCore incorrectly declared to accept bytes instead of string, like `QTimer.singleShot()` 20 | * fix `QColumnView`, `QHeaderView`, `QTreeView` and more to accept None as model argument in `setModel()` 21 | * allow `QProcess.ExitStatus.NormalExit.value` to be seen as `int` 22 | 23 | Version 6.4.2.0 24 | =============== 25 | * add all missing signals to the stubs (many were missing) 26 | * add conversion from `QByteArray` to `bytes` 27 | * add construction of `QByteArray` from length and string 28 | * fix `QFileDialog.getOpen*()` methods to accept `None` as parent argument 29 | * fix `QLineEdit.setText()` to accept `None` 30 | * fix `QTreeWidget.setItemWidget()` and `QListWidget.setItemWidget()` to accept `None` as a widget argument 31 | * fix `QProgressDialog.setCancelButton()` accepting `None` 32 | * support all `QSize` and `QSizeF` operations 33 | * fix `QTabBar.setButtonWidget()` to accept `None` as a widget argument 34 | * fix `QTreeWidget.topLevelItem()` returning possibly `None` 35 | * fix `QTreeWidgetItem` comparison with `<` 36 | * fix `QMessageBox.warning`, `information`, `critical`, `question`, `about`, `aboutQt` to accept `None` as parent argument 37 | * fix `qVersion()` returns string, not bytes 38 | * fix `qDebug()`, `qWarning()`, `qCritical()`, `qFatal()`, `SIGNAL()`, `SLOT()` to accept string, not bytes 39 | * fix `Signal.connect()`, `Signal.disconnect()`, `QObject.connect()` and `QObject.disconnect()` to accept `str` instead 40 | of `bool`, and to return `bool` on disconnect. 41 | * fix incorrect signature of `QCoreApplication.translate()` 42 | * improve signature of operations on `QPolygon` 43 | 44 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | How to contribute 4 | ================= 5 | 6 | You noticed correct code, reported as incorrectly typed ? You want to fix it ? Here is how you can do that. 7 | 8 | Note that there are two ways. One where you recreate a whole stub testing environment and ensure that your fix 9 | works fine. The second where you rely on the CI for the testing environment. 10 | 11 | The CI way 12 | ---------- 13 | 14 | This is the easiest/quickest way in terms of setup. 15 | 16 | 1. Clone pyside6-stubs 17 | 18 | 2. Add test showing the incorrect stub. For example, I noticed that QAction.setShortcut() was declared to support 19 | only QKeySequence whereas a simple string is also supported. 20 | 21 | So I created a new file tests\qaction.py using the correct code usage, but detected incorrectly by mypy: 22 | 23 | from PySide6.QtWidgets import QAction 24 | 25 | a = QAction() 26 | a.setShortcut('Ctrl+F') 27 | 28 | 29 | 3. Fix the PySide6 stubs. In my case, I changed the signature of QAction.setShortcut() 30 | 31 | from: 32 | 33 | def setShortcut(a: QKeySequence) -> None: ... 34 | 35 | to: 36 | 37 | def setShortcut(a: typing.Union[QKeySequence, str]) -> None: ... 38 | 39 | 40 | 4. Commit the change and push it to your repo. 41 | 42 | 43 | 5. Create a pull request against pyside6-stubs. The PR will run the CI for your change and ensure that all tests continue 44 | to pass successfully. I'll be happy to merge the result. 45 | 46 | 47 | 48 | 49 | The manual way 50 | -------------- 51 | 52 | Here, you take all the steps to reproduce a complete stub testing environement to include your change. 53 | 54 | 1. Clone pyside6-stubs 55 | 56 | 2. Create a virtual environment (I used .env as a name for my virtual environment) and activate it. 57 | 58 | $ python -m venv .env 59 | $ .env\scripts\activate 60 | 61 | 62 | 3. Install the required packages for running the tests. 63 | 64 | pip install -r dev-requirements.txt 65 | 66 | 67 | 4. Make your current directory an editable installed package. 68 | 69 | pip install -e . 70 | 71 | Note: currently, with pip 22 and above, and mypy 0.971, the editable installation is not picked by mypy. 72 | For the CI, I need to force pip to version 21.2 for it to work. You may need to force pip also to this version. 73 | 74 | 75 | 5. Make sure the tests run correctly as they are: 76 | 77 | $ pytest -v 78 | [...] 79 | ================================================= 60 passed in 13.07s ================================================= 80 | $ 81 | 82 | There should be no failure reported. 83 | 84 | 85 | 6. Add test showing the incorrect stub definitions. For example, I noticed that `QAction.setShortcut()` was declared to support 86 | only `QKeySequence` whereas a simple string is also supported. 87 | 88 | So I created a new file `tests\qaction.py` using the correct code usage, but detected incorrectly by mypy: 89 | 90 | from PySide6.QtWidgets import QAction 91 | 92 | a = QAction() 93 | a.setShortcut('Ctrl+F') 94 | 95 | 96 | 7. Run the tests again. Your new file should be picked up and reported as an error by the mypy test. 97 | 98 | 99 | (.env2) c:\oss\PyQt-stubs\PySide2-stubs>pytest -v 100 | ================================================= test session starts ================================================= 101 | platform win32 -- Python 3.10.2, pytest-7.1.3, pluggy-1.0.0 -- c:\oss\PyQt-stubs\PySide2-stubs\.env2\Scripts\python.exe 102 | cachedir: .pytest_cache 103 | rootdir: c:\oss\PyQt-stubs\PySide2-stubs 104 | collected 60 items 105 | 106 | tests/test_examples_here.py::test_examples_with_mypy[qaction.py] FAILED [ 1%] 107 | tests/test_examples_here.py::test_examples_with_mypy[qapplication.py] PASSED [ 3%] 108 | [...] 109 | tests/test_examples_here.py::test_examples_execution[signal_slot.py] PASSED [ 98%] 110 | tests/test_examples_here.py::test_examples_execution[slot.py] PASSED [100%] 111 | 112 | ====================================================== FAILURES ======================================================= 113 | _________________________________________ test_examples_with_mypy[qaction.py] _________________________________________ 114 | 115 | filepath = WindowsPath('c:/oss/PyQt-stubs/PySide2-stubs/tests/qaction.py') 116 | 117 | @pytest.mark.parametrize( 118 | "filepath", 119 | list(gen_file_list()), 120 | ids=[v.relative_to(TESTS_DIR).as_posix() for v in gen_file_list()], 121 | ) 122 | def test_examples_with_mypy(filepath: Path) -> None: 123 | """Run mypy over example files.""" 124 | stdout, stderr, exitcode = api.run([os.fspath(filepath)] + ['--show-error-codes']) 125 | if stdout: 126 | print(stdout) 127 | if stderr: 128 | print(stderr) 129 | 130 | > assert stdout.startswith("Success: no issues found") 131 | E assert False 132 | E + where False = ('Success: no issues found') 133 | E + where = 'tests\\qaction.py:4: error: Argument 1 to "setShortcut" of "QAction" has incompatible type "int"; expected "Union[QKeySequence, str]" [arg-type]\nFound 1 error in 1 file (checked 1 source file)\n'.startswith 134 | 135 | tests\test_examples_here.py:42: AssertionError 136 | ------------------------------------------------ Captured stdout call ------------------------------------------------- 137 | tests\qaction.py:4: error: Argument 1 to "setShortcut" of "QAction" has incompatible type "str"; expected "QKeySequence" [arg-type] 138 | Found 1 error in 1 file (checked 1 source file) 139 | 140 | =============================================== short test summary info =============================================== 141 | FAILED tests/test_examples_here.py::test_examples_with_mypy[qaction.py] - assert False 142 | ============================================ 1 failed, 59 passed in 8.82s ============================================= 143 | 144 | (.env2) c:\oss\PyQt-stubs\PySide2-stubs> 145 | 146 | 147 | Note that you can run your new test only by uing: pytest -k "your test name" -v 148 | 149 | 150 | 8. Fix the PySide6 stubs. In my case, I changed the signature of QAction.setShortcut() 151 | 152 | from: 153 | 154 | def setShortcut(a: QKeySequence) -> None: ... 155 | 156 | to: 157 | 158 | def setShortcut(a: typing.Union[QKeySequence, str]) -> None: ... 159 | 160 | 161 | 9. Rerun the tests. If it looks like mypy is still using the old stubs, delete .mypy-cache . It helps. 162 | You should now see no error, but two more tests successful. 163 | 164 | $ pytest -v 165 | [...] 166 | ================================================= 62 passed in 13.07s ================================================= 167 | $ 168 | 169 | 10. Commit your changes and push them to your repository. 170 | 171 | 11. Create a pull request. I'll be glad to merge it. The CI will run basically the same tests that you did over your changes. 172 | -------------------------------------------------------------------------------- /NOTES.md: -------------------------------------------------------------------------------- 1 | 2 | Food for thought, possible improvements: 3 | 4 | 5 | ## enum 6 | 7 | All Qt enum are actually integers like 8 | 9 | class ExitStatus(enum.Enum): 10 | 11 | NormalExit : QProcess.ExitStatus = ... # 0x0 12 | CrashExit : QProcess.ExitStatus = ... # 0x1 13 | 14 | The following code will work in python: 15 | 16 | v = QProcess.ExitStatus.NormalExit.value 17 | 18 | But it won't typecheck... 19 | 20 | One way to address this is to lie and pretend there are IntEnum 21 | 22 | class ExitStatus(enum.IntEnum): 23 | 24 | NormalExit : QProcess.ExitStatus = ... # 0x0 25 | CrashExit : QProcess.ExitStatus = ... # 0x1 26 | 27 | Should we do this for all Qt enums ? 28 | -------------------------------------------------------------------------------- /PYSIDE6_ISSUES.md: -------------------------------------------------------------------------------- 1 | 2 | PySide6 has made great progresses over the year on typing. This file lists the remaining issues 3 | and their status in Qt bugtracker. 4 | 5 | 6 | Reported issues 7 | =============== 8 | * [PYSIDE-3034 - Typing: stubs are missing public variables](https://bugreports.qt.io/browse/PYSIDE-3034) 9 | * [PYSIDE-3037 - Typing: allow QByteArray to convert to bytes](https://bugreports.qt.io/browse/PYSIDE-3037) 10 | * [PYSIDE-3038 - Typing: QDateTime accepts python datetime objects](https://bugreports.qt.io/browse/PYSIDE-3038) 11 | * [PYSIDE-3039 - Typing: QHBoxLayout does not accept None as parent](https://bugreports.qt.io/browse/PYSIDE-3039) 12 | * [PYSIDE-3043 - Typing: QMessageBox static methods should support parent = None](https://bugreports.qt.io/browse/PYSIDE-3043) 13 | * [PYSIDE-3046 - Typing: bad type signature for QObject.inherits()](https://bugreports.qt.io/browse/PYSIDE-3046) 14 | * [PYSIDE-3047 - Typing: fix QPolygon << operator](https://bugreports.qt.io/browse/PYSIDE-3047) 15 | * [PYSIDE-3048 - Typing: use IntEnum instead of enum](https://bugreports.qt.io/browse/PYSIDE-3048) 16 | * [PYSIDE-3050 - Typing: QProgressDialog.setCancelButton() should accept None](https://bugreports.qt.io/browse/PYSIDE-3050) 17 | * [PYSIDE-3051 - Typing: support more scalar operators for QSize and QSizeF](https://bugreports.qt.io/browse/PYSIDE-3051) 18 | * [PYSIDE-3055 - Typing: QTabBar.setTabButton() should accept None](https://bugreports.qt.io/browse/PYSIDE-3055) 19 | * [PYSIDE-3056 - Typing: qtTrId() argument should be string](https://bugreports.qt.io/browse/PYSIDE-3056) 20 | * [PYSIDE-3057 - Typing: QTreeWidget.setItemWidget() accepts None](https://bugreports.qt.io/browse/PYSIDE-3057) 21 | * [PYSIDE-3058 - Typing: QTredWidget.topLevelItem() may return None](https://bugreports.qt.io/browse/PYSIDE-3058) 22 | * 23 | 24 | Fixed issues 25 | ============ 26 | * [PYSIDE-3045 - Typing: QObject.findChildren() and findChild() need typing improvements](https://bugreports.qt.io/browse/PYSIDE-3045) 27 | * [PYSIDE-3044 - Typing: QMessageBox.information() should have a default button](https://bugreports.qt.io/browse/PYSIDE-3044) 28 | * [PYSIDE-3042 - Typing: QListWidget.setItemWidget() accepts None](https://bugreports.qt.io/browse/PYSIDE-3042) 29 | * [PYSIDE-3041 - Typing: QLineEdit.setText() accepts None](https://bugreports.qt.io/browse/PYSIDE-3041) 30 | * [PYSIDE-3036 - Typing: QModelIndex.constInternalPointer() should return Any](https://bugreports.qt.io/browse/PYSIDE-3036) 31 | * fix incorrect signature of `QCoreApplication.translate()` 32 | * add all missing signals to the stubs (many were missing) 33 | * fix `QStateMachine.assignProperty()` type signature 34 | * add typing information for all properties 35 | -------------------------------------------------------------------------------- /PySide6-stubs/Qt3DLogic.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.Qt3DLogic, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.Qt3DLogic` 11 | 12 | import PySide6.Qt3DLogic 13 | import PySide6.QtCore 14 | import PySide6.Qt3DCore 15 | 16 | from typing import ClassVar, Optional 17 | from PySide6.QtCore import Signal 18 | from shiboken6 import Shiboken 19 | from typing import TypeAlias, TypeVar 20 | 21 | 22 | NoneType: TypeAlias = type[None] 23 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 24 | 25 | 26 | class QIntList(object): ... 27 | 28 | 29 | class Qt3DLogic(Shiboken.Object): 30 | 31 | class QFrameAction(PySide6.Qt3DCore.Qt3DCore.QComponent): 32 | 33 | triggered : ClassVar[Signal] = ... # triggered(float) 34 | 35 | def __init__(self, parent: Optional[PySide6.Qt3DCore.Qt3DCore.QNode] = ...) -> None: ... 36 | 37 | 38 | class QLogicAspect(PySide6.Qt3DCore.Qt3DCore.QAbstractAspect): 39 | 40 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 41 | 42 | 43 | # eof 44 | -------------------------------------------------------------------------------- /PySide6-stubs/QtAxContainer.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtAxContainer, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtAxContainer` 11 | 12 | import PySide6.QtAxContainer 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | 17 | import enum 18 | from typing import Any, ClassVar, Container, Dict, List, Optional, Sequence, Union, overload 19 | from PySide6.QtCore import Signal 20 | from shiboken6 import Shiboken 21 | from typing import TypeAlias, TypeVar 22 | 23 | 24 | NoneType: TypeAlias = type[None] 25 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 26 | 27 | 28 | class QAxBase(Shiboken.Object): 29 | 30 | def __init__(self) -> None: ... 31 | 32 | def __lshift__(self, s: PySide6.QtCore.QDataStream) -> PySide6.QtCore.QDataStream: ... 33 | def __rshift__(self, s: PySide6.QtCore.QDataStream) -> PySide6.QtCore.QDataStream: ... 34 | @staticmethod 35 | def argumentsToList(var1: Any, var2: Any, var3: Any, var4: Any, var5: Any, var6: Any, var7: Any, var8: Any) -> List[Any]: ... 36 | def asVariant(self) -> Any: ... 37 | def axBaseMetaObject(self) -> PySide6.QtCore.QMetaObject: ... 38 | def classContext(self) -> int: ... 39 | def className(self) -> Union[bytes, bytearray, memoryview]: ... 40 | def clear(self) -> None: ... 41 | def control(self) -> str: ... 42 | def disableClassInfo(self) -> None: ... 43 | def disableEventSink(self) -> None: ... 44 | def disableMetaObject(self) -> None: ... 45 | @overload 46 | def dynamicCall(self, name: Union[bytes, bytearray, memoryview], v1: Any = ..., v2: Any = ..., v3: Any = ..., v4: Any = ..., v5: Any = ..., v6: Any = ..., v7: Any = ..., v8: Any = ...) -> Any: ... 47 | @overload 48 | def dynamicCall(self, name: Union[bytes, bytearray, memoryview], vars: Sequence[Any]) -> Any: ... 49 | def generateDocumentation(self) -> str: ... 50 | def indexOfVerb(self, verb: str) -> int: ... 51 | def initializeFrom(self, that: PySide6.QtAxContainer.QAxBase) -> None: ... 52 | def internalRelease(self) -> None: ... 53 | def isNull(self) -> bool: ... 54 | def propertyBag(self) -> Dict[str, Any]: ... 55 | def propertyWritable(self, arg__1: Union[bytes, bytearray, memoryview]) -> bool: ... 56 | def qObject(self) -> PySide6.QtCore.QObject: ... 57 | @overload 58 | def querySubObject(self, name: Union[bytes, bytearray, memoryview], v1: Any = ..., v2: Any = ..., v3: Any = ..., v4: Any = ..., v5: Any = ..., v6: Any = ..., v7: Any = ..., v8: Any = ...) -> PySide6.QtAxContainer.QAxObject: ... 59 | @overload 60 | def querySubObject(self, name: Union[bytes, bytearray, memoryview], vars: Sequence[Any]) -> PySide6.QtAxContainer.QAxObject: ... 61 | def setClassContext(self, classContext: int) -> None: ... 62 | def setControl(self, arg__1: str) -> bool: ... 63 | def setPropertyBag(self, arg__1: Dict[str, Any]) -> None: ... 64 | def setPropertyWritable(self, arg__1: Union[bytes, bytearray, memoryview], arg__2: bool) -> None: ... 65 | def verbs(self) -> List[str]: ... 66 | 67 | 68 | class QAxBaseObject(PySide6.QtCore.QObject, PySide6.QtAxContainer.QAxObjectInterface): 69 | 70 | exception : ClassVar[Signal] = ... # exception(int,QString,QString,QString) 71 | propertyChanged : ClassVar[Signal] = ... # propertyChanged(QString) 72 | signal : ClassVar[Signal] = ... # signal(QString,int,void*) 73 | 74 | 75 | class QAxBaseWidget(PySide6.QtWidgets.QWidget, PySide6.QtAxContainer.QAxObjectInterface): 76 | 77 | exception : ClassVar[Signal] = ... # exception(int,QString,QString,QString) 78 | propertyChanged : ClassVar[Signal] = ... # propertyChanged(QString) 79 | signal : ClassVar[Signal] = ... # signal(QString,int,void*) 80 | 81 | 82 | class QAxObject(PySide6.QtAxContainer.QAxBaseObject, PySide6.QtAxContainer.QAxBase): 83 | 84 | exception: PySide6.QtCore.Signal 85 | propertyChanged: PySide6.QtCore.Signal 86 | signal: PySide6.QtCore.Signal 87 | 88 | 89 | @overload 90 | def __init__(self, c: str, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 91 | @overload 92 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 93 | 94 | def classContext(self) -> int: ... 95 | def clear(self) -> None: ... 96 | def control(self) -> str: ... 97 | def doVerb(self, verb: str) -> bool: ... 98 | def resetControl(self) -> None: ... 99 | def setClassContext(self, classContext: int) -> None: ... 100 | def setControl(self, c: str) -> bool: ... 101 | 102 | 103 | class QAxObjectInterface(Shiboken.Object): 104 | 105 | def __init__(self) -> None: ... 106 | 107 | def classContext(self) -> int: ... 108 | def control(self) -> str: ... 109 | def resetControl(self) -> None: ... 110 | def setClassContext(self, classContext: int) -> None: ... 111 | def setControl(self, c: str) -> bool: ... 112 | 113 | 114 | class QAxScript(PySide6.QtCore.QObject): 115 | 116 | entered : ClassVar[Signal] = ... # entered() 117 | error : ClassVar[Signal] = ... # error(int,QString,int,QString) 118 | finished : ClassVar[Signal] = ... # finished(); finished(QVariant); finished(int,QString,QString,QString) 119 | stateChanged : ClassVar[Signal] = ... # stateChanged(int) 120 | 121 | class FunctionFlags(enum.Enum): 122 | 123 | FunctionNames : QAxScript.FunctionFlags = ... # 0x0 124 | FunctionSignatures : QAxScript.FunctionFlags = ... # 0x1 125 | 126 | 127 | def __init__(self, name: str, manager: PySide6.QtAxContainer.QAxScriptManager) -> None: ... 128 | 129 | @overload 130 | def call(self, function: str, arguments: Sequence[Any]) -> Any: ... 131 | @overload 132 | def call(self, function: str, v1: Any = ..., v2: Any = ..., v3: Any = ..., v4: Any = ..., v5: Any = ..., v6: Any = ..., v7: Any = ..., v8: Any = ...) -> Any: ... 133 | def functions(self, arg__1: PySide6.QtAxContainer.QAxScript.FunctionFlags = ...) -> List[str]: ... 134 | def load(self, code: str, language: str = ...) -> bool: ... 135 | def scriptCode(self) -> str: ... 136 | def scriptEngine(self) -> PySide6.QtAxContainer.QAxScriptEngine: ... 137 | def scriptName(self) -> str: ... 138 | 139 | 140 | class QAxScriptEngine(PySide6.QtAxContainer.QAxObject): 141 | 142 | class State(enum.Enum): 143 | 144 | Uninitialized : QAxScriptEngine.State = ... # 0x0 145 | Started : QAxScriptEngine.State = ... # 0x1 146 | Connected : QAxScriptEngine.State = ... # 0x2 147 | Disconnected : QAxScriptEngine.State = ... # 0x3 148 | Closed : QAxScriptEngine.State = ... # 0x4 149 | Initialized : QAxScriptEngine.State = ... # 0x5 150 | 151 | 152 | def __init__(self, language: str, script: PySide6.QtAxContainer.QAxScript) -> None: ... 153 | 154 | def addItem(self, name: str) -> None: ... 155 | def hasIntrospection(self) -> bool: ... 156 | def isValid(self) -> bool: ... 157 | def scriptLanguage(self) -> str: ... 158 | def setState(self, st: PySide6.QtAxContainer.QAxScriptEngine.State) -> None: ... 159 | def state(self) -> PySide6.QtAxContainer.QAxScriptEngine.State: ... 160 | 161 | 162 | class QAxScriptManager(PySide6.QtCore.QObject): 163 | 164 | error : ClassVar[Signal] = ... # error(QAxScript*,int,QString,int,QString) 165 | 166 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 167 | 168 | def addObject(self, object: PySide6.QtAxContainer.QAxBase) -> None: ... 169 | @overload 170 | def call(self, function: str, arguments: Sequence[Any]) -> Any: ... 171 | @overload 172 | def call(self, function: str, v1: Any = ..., v2: Any = ..., v3: Any = ..., v4: Any = ..., v5: Any = ..., v6: Any = ..., v7: Any = ..., v8: Any = ...) -> Any: ... 173 | def functions(self, arg__1: PySide6.QtAxContainer.QAxScript.FunctionFlags = ...) -> List[str]: ... 174 | @overload 175 | def load(self, code: str, name: str, language: str) -> PySide6.QtAxContainer.QAxScript: ... 176 | @overload 177 | def load(self, file: str, name: str) -> PySide6.QtAxContainer.QAxScript: ... 178 | @staticmethod 179 | def registerEngine(name: str, extension: str, code: str = ...) -> bool: ... 180 | def script(self, name: str) -> PySide6.QtAxContainer.QAxScript: ... 181 | @staticmethod 182 | def scriptFileFilter() -> str: ... 183 | def scriptNames(self) -> List[str]: ... 184 | 185 | 186 | class QAxSelect(PySide6.QtWidgets.QDialog): 187 | 188 | class SandboxingLevel(enum.Enum): 189 | 190 | SandboxingNone : QAxSelect.SandboxingLevel = ... # 0x0 191 | SandboxingProcess : QAxSelect.SandboxingLevel = ... # 0x1 192 | SandboxingLowIntegrity : QAxSelect.SandboxingLevel = ... # 0x2 193 | SandboxingAppContainer : QAxSelect.SandboxingLevel = ... # 0x3 194 | 195 | 196 | def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ..., flags: PySide6.QtCore.Qt.WindowType = ...) -> None: ... 197 | 198 | def clsid(self) -> str: ... 199 | def sandboxingLevel(self) -> PySide6.QtAxContainer.QAxSelect.SandboxingLevel: ... 200 | 201 | 202 | class QAxWidget(PySide6.QtAxContainer.QAxBaseWidget, PySide6.QtAxContainer.QAxBase): 203 | 204 | exception: PySide6.QtCore.Signal 205 | propertyChanged: PySide6.QtCore.Signal 206 | signal: PySide6.QtCore.Signal 207 | 208 | 209 | @overload 210 | def __init__(self, c: str, parent: Optional[PySide6.QtWidgets.QWidget] = ..., f: PySide6.QtCore.Qt.WindowType = ...) -> None: ... 211 | @overload 212 | def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ..., f: PySide6.QtCore.Qt.WindowType = ...) -> None: ... 213 | 214 | def changeEvent(self, e: PySide6.QtCore.QEvent) -> None: ... 215 | def classContext(self) -> int: ... 216 | def clear(self) -> None: ... 217 | def control(self) -> str: ... 218 | @overload 219 | def createHostWindow(self, arg__1: bool) -> bool: ... 220 | @overload 221 | def createHostWindow(self, arg__1: bool, arg__2: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> bool: ... 222 | def doVerb(self, verb: str) -> bool: ... 223 | def minimumSizeHint(self) -> PySide6.QtCore.QSize: ... 224 | def resetControl(self) -> None: ... 225 | def resizeEvent(self, arg__1: PySide6.QtGui.QResizeEvent) -> None: ... 226 | def setClassContext(self, classContext: int) -> None: ... 227 | def setControl(self, arg__1: str) -> bool: ... 228 | def sizeHint(self) -> PySide6.QtCore.QSize: ... 229 | def translateKeyEvent(self, message: int, keycode: int) -> bool: ... 230 | 231 | 232 | class QIntList(object): ... 233 | 234 | 235 | # eof 236 | -------------------------------------------------------------------------------- /PySide6-stubs/QtConcurrent.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtConcurrent, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtConcurrent` 11 | 12 | import PySide6.QtConcurrent 13 | import PySide6.QtCore 14 | 15 | import enum 16 | from typing import Optional, overload 17 | from shiboken6 import Shiboken 18 | from typing import TypeAlias, TypeVar 19 | 20 | 21 | NoneType: TypeAlias = type[None] 22 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 23 | 24 | 25 | class QFutureQString(Shiboken.Object): 26 | 27 | @overload 28 | def __init__(self) -> None: ... 29 | @overload 30 | def __init__(self, QFutureQString: PySide6.QtConcurrent.QFutureQString) -> None: ... 31 | 32 | @staticmethod 33 | def __copy__() -> None: ... 34 | def cancel(self) -> None: ... 35 | def isCanceled(self) -> bool: ... 36 | def isFinished(self) -> bool: ... 37 | def isPaused(self) -> bool: ... 38 | def isRunning(self) -> bool: ... 39 | def isStarted(self) -> bool: ... 40 | def isSuspended(self) -> bool: ... 41 | def isSuspending(self) -> bool: ... 42 | def isValid(self) -> bool: ... 43 | def pause(self) -> None: ... 44 | def progressMaximum(self) -> int: ... 45 | def progressMinimum(self) -> int: ... 46 | def progressText(self) -> str: ... 47 | def progressValue(self) -> int: ... 48 | def resultCount(self) -> int: ... 49 | def resume(self) -> None: ... 50 | def setPaused(self, paused: bool) -> None: ... 51 | def setSuspended(self, suspend: bool) -> None: ... 52 | def suspend(self) -> None: ... 53 | def togglePaused(self) -> None: ... 54 | def toggleSuspended(self) -> None: ... 55 | def waitForFinished(self) -> None: ... 56 | 57 | 58 | class QFutureVoid(Shiboken.Object): 59 | 60 | @overload 61 | def __init__(self) -> None: ... 62 | @overload 63 | def __init__(self, QFutureVoid: PySide6.QtConcurrent.QFutureVoid) -> None: ... 64 | 65 | @staticmethod 66 | def __copy__() -> None: ... 67 | def cancel(self) -> None: ... 68 | def isCanceled(self) -> bool: ... 69 | def isFinished(self) -> bool: ... 70 | def isPaused(self) -> bool: ... 71 | def isRunning(self) -> bool: ... 72 | def isStarted(self) -> bool: ... 73 | def isSuspended(self) -> bool: ... 74 | def isSuspending(self) -> bool: ... 75 | def isValid(self) -> bool: ... 76 | def pause(self) -> None: ... 77 | def progressMaximum(self) -> int: ... 78 | def progressMinimum(self) -> int: ... 79 | def progressText(self) -> str: ... 80 | def progressValue(self) -> int: ... 81 | def resultCount(self) -> int: ... 82 | def resume(self) -> None: ... 83 | def setPaused(self, paused: bool) -> None: ... 84 | def setSuspended(self, suspend: bool) -> None: ... 85 | def suspend(self) -> None: ... 86 | def togglePaused(self) -> None: ... 87 | def toggleSuspended(self) -> None: ... 88 | def waitForFinished(self) -> None: ... 89 | 90 | 91 | class QFutureWatcherQString(PySide6.QtCore.QObject): 92 | 93 | canceled: PySide6.QtCore.Signal 94 | finished: PySide6.QtCore.Signal 95 | paused: PySide6.QtCore.Signal 96 | progressRangeChanged: PySide6.QtCore.Signal 97 | progressTextChanged: PySide6.QtCore.Signal 98 | progressValueChanged: PySide6.QtCore.Signal 99 | resultReadyAt: PySide6.QtCore.Signal 100 | resultsReadyAt: PySide6.QtCore.Signal 101 | resumed: PySide6.QtCore.Signal 102 | started: PySide6.QtCore.Signal 103 | suspended: PySide6.QtCore.Signal 104 | suspending: PySide6.QtCore.Signal 105 | 106 | 107 | def __init__(self, _parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 108 | 109 | def future(self) -> PySide6.QtConcurrent.QFutureQString: ... 110 | def setFuture(self, future: PySide6.QtConcurrent.QFutureQString) -> None: ... 111 | 112 | 113 | class QFutureWatcherVoid(PySide6.QtCore.QObject): 114 | 115 | canceled: PySide6.QtCore.Signal 116 | finished: PySide6.QtCore.Signal 117 | paused: PySide6.QtCore.Signal 118 | progressRangeChanged: PySide6.QtCore.Signal 119 | progressTextChanged: PySide6.QtCore.Signal 120 | progressValueChanged: PySide6.QtCore.Signal 121 | resultReadyAt: PySide6.QtCore.Signal 122 | resultsReadyAt: PySide6.QtCore.Signal 123 | resumed: PySide6.QtCore.Signal 124 | started: PySide6.QtCore.Signal 125 | suspended: PySide6.QtCore.Signal 126 | suspending: PySide6.QtCore.Signal 127 | 128 | 129 | def __init__(self, _parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 130 | 131 | 132 | class QIntList(object): ... 133 | 134 | 135 | class QtConcurrent(Shiboken.Object): 136 | 137 | class FutureResult(enum.Enum): 138 | 139 | Ignore : QtConcurrent.FutureResult = ... # 0x0 140 | 141 | class ReduceOption(enum.Flag): 142 | 143 | UnorderedReduce : QtConcurrent.ReduceOption = ... # 0x1 144 | OrderedReduce : QtConcurrent.ReduceOption = ... # 0x2 145 | SequentialReduce : QtConcurrent.ReduceOption = ... # 0x4 146 | 147 | class ThreadFunctionResult(enum.Enum): 148 | 149 | ThrottleThread : QtConcurrent.ThreadFunctionResult = ... # 0x0 150 | ThreadFinished : QtConcurrent.ThreadFunctionResult = ... # 0x1 151 | 152 | 153 | # eof 154 | -------------------------------------------------------------------------------- /PySide6-stubs/QtHttpServer.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtHttpServer, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtHttpServer` 11 | 12 | import PySide6.QtHttpServer 13 | import PySide6.QtCore 14 | import PySide6.QtNetwork 15 | 16 | import os 17 | import enum 18 | from typing import Callable, Dict, List, Optional, Tuple, Type, Union, overload 19 | from shiboken6 import Shiboken 20 | from typing import TypeAlias, TypeVar 21 | 22 | 23 | NoneType: TypeAlias = type[None] 24 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 25 | 26 | 27 | class QAbstractHttpServer(PySide6.QtCore.QObject): 28 | 29 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 30 | 31 | @overload 32 | def bind(self, server: PySide6.QtNetwork.QLocalServer) -> None: ... 33 | @overload 34 | def bind(self, server: Optional[PySide6.QtNetwork.QTcpServer] = ...) -> None: ... 35 | def listen(self, address: Union[PySide6.QtNetwork.QHostAddress, PySide6.QtNetwork.QHostAddress.SpecialAddress] = ..., port: int = ...) -> int: ... 36 | def localServers(self) -> List[PySide6.QtNetwork.QLocalServer]: ... 37 | def serverPorts(self) -> List[int]: ... 38 | def servers(self) -> List[PySide6.QtNetwork.QTcpServer]: ... 39 | @overload 40 | def sslSetup(self, certificate: Union[PySide6.QtNetwork.QSslCertificate, PySide6.QtCore.QIODevice], privateKey: Union[PySide6.QtNetwork.QSslKey, int], protocol: PySide6.QtNetwork.QSsl.SslProtocol = ...) -> None: ... 41 | @overload 42 | def sslSetup(self, sslConfiguration: PySide6.QtNetwork.QSslConfiguration) -> None: ... 43 | 44 | 45 | class QFutureHttpServerResponse(Shiboken.Object): 46 | 47 | @overload 48 | def __init__(self) -> None: ... 49 | @overload 50 | def __init__(self, QFutureHttpServerResponse: PySide6.QtHttpServer.QFutureHttpServerResponse) -> None: ... 51 | 52 | @staticmethod 53 | def __copy__() -> None: ... 54 | def cancel(self) -> None: ... 55 | def isCanceled(self) -> bool: ... 56 | def isFinished(self) -> bool: ... 57 | def isPaused(self) -> bool: ... 58 | def isRunning(self) -> bool: ... 59 | def isStarted(self) -> bool: ... 60 | def isSuspended(self) -> bool: ... 61 | def isSuspending(self) -> bool: ... 62 | def isValid(self) -> bool: ... 63 | def pause(self) -> None: ... 64 | def progressMaximum(self) -> int: ... 65 | def progressMinimum(self) -> int: ... 66 | def progressText(self) -> str: ... 67 | def progressValue(self) -> int: ... 68 | def resultCount(self) -> int: ... 69 | def resume(self) -> None: ... 70 | def setPaused(self, paused: bool) -> None: ... 71 | def setSuspended(self, suspend: bool) -> None: ... 72 | def suspend(self) -> None: ... 73 | def togglePaused(self) -> None: ... 74 | def toggleSuspended(self) -> None: ... 75 | def waitForFinished(self) -> None: ... 76 | 77 | 78 | class QHttpServer(PySide6.QtHttpServer.QAbstractHttpServer): 79 | 80 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 81 | 82 | def afterRequest(self, callback: Callable) -> None: ... 83 | def handleRequest(self, request: PySide6.QtHttpServer.QHttpServerRequest, responder: PySide6.QtHttpServer.QHttpServerResponder) -> bool: ... 84 | def route(self, rule: str, callback: Callable) -> bool: ... 85 | def router(self) -> PySide6.QtHttpServer.QHttpServerRouter: ... 86 | 87 | 88 | class QHttpServerRequest(Shiboken.Object): 89 | 90 | class Method(enum.Flag): 91 | 92 | Unknown : QHttpServerRequest.Method = ... # 0x0 93 | Get : QHttpServerRequest.Method = ... # 0x1 94 | Put : QHttpServerRequest.Method = ... # 0x2 95 | Delete : QHttpServerRequest.Method = ... # 0x4 96 | Post : QHttpServerRequest.Method = ... # 0x8 97 | Head : QHttpServerRequest.Method = ... # 0x10 98 | Options : QHttpServerRequest.Method = ... # 0x20 99 | Patch : QHttpServerRequest.Method = ... # 0x40 100 | Connect : QHttpServerRequest.Method = ... # 0x80 101 | Trace : QHttpServerRequest.Method = ... # 0x100 102 | AnyKnown : QHttpServerRequest.Method = ... # 0x1ff 103 | 104 | 105 | def body(self) -> PySide6.QtCore.QByteArray: ... 106 | def headers(self) -> List[Tuple[PySide6.QtCore.QByteArray, PySide6.QtCore.QByteArray]]: ... 107 | def localAddress(self) -> PySide6.QtNetwork.QHostAddress: ... 108 | def localPort(self) -> int: ... 109 | def method(self) -> PySide6.QtHttpServer.QHttpServerRequest.Method: ... 110 | def query(self) -> PySide6.QtCore.QUrlQuery: ... 111 | def remoteAddress(self) -> PySide6.QtNetwork.QHostAddress: ... 112 | def remotePort(self) -> int: ... 113 | def sslConfiguration(self) -> PySide6.QtNetwork.QSslConfiguration: ... 114 | def url(self) -> PySide6.QtCore.QUrl: ... 115 | def value(self, key: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> PySide6.QtCore.QByteArray: ... 116 | 117 | 118 | class QHttpServerResponder(Shiboken.Object): 119 | 120 | class StatusCode(enum.Enum): 121 | 122 | Continue : QHttpServerResponder.StatusCode = ... # 0x64 123 | SwitchingProtocols : QHttpServerResponder.StatusCode = ... # 0x65 124 | Processing : QHttpServerResponder.StatusCode = ... # 0x66 125 | Ok : QHttpServerResponder.StatusCode = ... # 0xc8 126 | Created : QHttpServerResponder.StatusCode = ... # 0xc9 127 | Accepted : QHttpServerResponder.StatusCode = ... # 0xca 128 | NonAuthoritativeInformation: QHttpServerResponder.StatusCode = ... # 0xcb 129 | NoContent : QHttpServerResponder.StatusCode = ... # 0xcc 130 | ResetContent : QHttpServerResponder.StatusCode = ... # 0xcd 131 | PartialContent : QHttpServerResponder.StatusCode = ... # 0xce 132 | MultiStatus : QHttpServerResponder.StatusCode = ... # 0xcf 133 | AlreadyReported : QHttpServerResponder.StatusCode = ... # 0xd0 134 | IMUsed : QHttpServerResponder.StatusCode = ... # 0xe2 135 | MultipleChoices : QHttpServerResponder.StatusCode = ... # 0x12c 136 | MovedPermanently : QHttpServerResponder.StatusCode = ... # 0x12d 137 | Found : QHttpServerResponder.StatusCode = ... # 0x12e 138 | SeeOther : QHttpServerResponder.StatusCode = ... # 0x12f 139 | NotModified : QHttpServerResponder.StatusCode = ... # 0x130 140 | UseProxy : QHttpServerResponder.StatusCode = ... # 0x131 141 | TemporaryRedirect : QHttpServerResponder.StatusCode = ... # 0x133 142 | PermanentRedirect : QHttpServerResponder.StatusCode = ... # 0x134 143 | BadRequest : QHttpServerResponder.StatusCode = ... # 0x190 144 | Unauthorized : QHttpServerResponder.StatusCode = ... # 0x191 145 | PaymentRequired : QHttpServerResponder.StatusCode = ... # 0x192 146 | Forbidden : QHttpServerResponder.StatusCode = ... # 0x193 147 | NotFound : QHttpServerResponder.StatusCode = ... # 0x194 148 | MethodNotAllowed : QHttpServerResponder.StatusCode = ... # 0x195 149 | NotAcceptable : QHttpServerResponder.StatusCode = ... # 0x196 150 | ProxyAuthenticationRequired: QHttpServerResponder.StatusCode = ... # 0x197 151 | RequestTimeout : QHttpServerResponder.StatusCode = ... # 0x198 152 | Conflict : QHttpServerResponder.StatusCode = ... # 0x199 153 | Gone : QHttpServerResponder.StatusCode = ... # 0x19a 154 | LengthRequired : QHttpServerResponder.StatusCode = ... # 0x19b 155 | PreconditionFailed : QHttpServerResponder.StatusCode = ... # 0x19c 156 | PayloadTooLarge : QHttpServerResponder.StatusCode = ... # 0x19d 157 | UriTooLong : QHttpServerResponder.StatusCode = ... # 0x19e 158 | UnsupportedMediaType : QHttpServerResponder.StatusCode = ... # 0x19f 159 | RequestRangeNotSatisfiable: QHttpServerResponder.StatusCode = ... # 0x1a0 160 | ExpectationFailed : QHttpServerResponder.StatusCode = ... # 0x1a1 161 | ImATeapot : QHttpServerResponder.StatusCode = ... # 0x1a2 162 | MisdirectedRequest : QHttpServerResponder.StatusCode = ... # 0x1a5 163 | UnprocessableEntity : QHttpServerResponder.StatusCode = ... # 0x1a6 164 | Locked : QHttpServerResponder.StatusCode = ... # 0x1a7 165 | FailedDependency : QHttpServerResponder.StatusCode = ... # 0x1a8 166 | UpgradeRequired : QHttpServerResponder.StatusCode = ... # 0x1aa 167 | PreconditionRequired : QHttpServerResponder.StatusCode = ... # 0x1ac 168 | TooManyRequests : QHttpServerResponder.StatusCode = ... # 0x1ad 169 | RequestHeaderFieldsTooLarge: QHttpServerResponder.StatusCode = ... # 0x1af 170 | UnavailableForLegalReasons: QHttpServerResponder.StatusCode = ... # 0x1c3 171 | InternalServerError : QHttpServerResponder.StatusCode = ... # 0x1f4 172 | NotImplemented : QHttpServerResponder.StatusCode = ... # 0x1f5 173 | BadGateway : QHttpServerResponder.StatusCode = ... # 0x1f6 174 | ServiceUnavailable : QHttpServerResponder.StatusCode = ... # 0x1f7 175 | GatewayTimeout : QHttpServerResponder.StatusCode = ... # 0x1f8 176 | HttpVersionNotSupported : QHttpServerResponder.StatusCode = ... # 0x1f9 177 | VariantAlsoNegotiates : QHttpServerResponder.StatusCode = ... # 0x1fa 178 | InsufficientStorage : QHttpServerResponder.StatusCode = ... # 0x1fb 179 | LoopDetected : QHttpServerResponder.StatusCode = ... # 0x1fc 180 | NotExtended : QHttpServerResponder.StatusCode = ... # 0x1fe 181 | NetworkAuthenticationRequired: QHttpServerResponder.StatusCode = ... # 0x1ff 182 | NetworkConnectTimeoutError: QHttpServerResponder.StatusCode = ... # 0x257 183 | 184 | 185 | def sendResponse(self, response: PySide6.QtHttpServer.QHttpServerResponse) -> None: ... 186 | @overload 187 | def write(self, data: PySide6.QtCore.QIODevice, mimeType: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 188 | @overload 189 | def write(self, data: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], mimeType: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 190 | @overload 191 | def write(self, document: PySide6.QtCore.QJsonDocument, status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 192 | @overload 193 | def write(self, status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 194 | @overload 195 | def writeBody(self, body: Union[bytes, bytearray, memoryview]) -> None: ... 196 | @overload 197 | def writeBody(self, body: Union[bytes, bytearray, memoryview], size: int) -> None: ... 198 | @overload 199 | def writeBody(self, body: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ... 200 | def writeHeader(self, key: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], value: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ... 201 | def writeStatusLine(self, status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 202 | 203 | 204 | class QHttpServerResponse(Shiboken.Object): 205 | 206 | @overload 207 | def __init__(self, data: PySide6.QtCore.QJsonArray, status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 208 | @overload 209 | def __init__(self, data: Dict[str, PySide6.QtCore.QJsonValue], status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 210 | @overload 211 | def __init__(self, data: str, status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 212 | @overload 213 | def __init__(self, data: Union[bytes, bytearray, memoryview], status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 214 | @overload 215 | def __init__(self, data: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 216 | @overload 217 | def __init__(self, mimeType: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], data: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], status: PySide6.QtHttpServer.QHttpServerResponder.StatusCode = ...) -> None: ... 218 | @overload 219 | def __init__(self, statusCode: PySide6.QtHttpServer.QHttpServerResponder.StatusCode) -> None: ... 220 | 221 | def addHeader(self, name: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], value: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ... 222 | def clearHeader(self, name: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ... 223 | def clearHeaders(self) -> None: ... 224 | def data(self) -> PySide6.QtCore.QByteArray: ... 225 | @staticmethod 226 | def fromFile(fileName: str) -> PySide6.QtHttpServer.QHttpServerResponse: ... 227 | @overload 228 | def hasHeader(self, name: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> bool: ... 229 | @overload 230 | def hasHeader(self, name: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], value: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> bool: ... 231 | def headers(self, name: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> List[PySide6.QtCore.QByteArray]: ... 232 | def mimeType(self) -> PySide6.QtCore.QByteArray: ... 233 | def setHeader(self, name: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], value: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ... 234 | def statusCode(self) -> PySide6.QtHttpServer.QHttpServerResponder.StatusCode: ... 235 | 236 | 237 | class QHttpServerRouter(Shiboken.Object): 238 | 239 | def __init__(self) -> None: ... 240 | 241 | def addConverter(self, metaType: Union[PySide6.QtCore.QMetaType, PySide6.QtCore.QMetaType.Type], regexp: str) -> None: ... 242 | def clearConverters(self) -> None: ... 243 | def converters(self) -> Dict[PySide6.QtCore.QMetaType, str]: ... 244 | def handleRequest(self, request: PySide6.QtHttpServer.QHttpServerRequest, responder: PySide6.QtHttpServer.QHttpServerResponder) -> bool: ... 245 | def removeConverter(self, metaType: Union[PySide6.QtCore.QMetaType, PySide6.QtCore.QMetaType.Type]) -> None: ... 246 | 247 | 248 | class QHttpServerRouterRule(Shiboken.Object): 249 | def exec(self, request: PySide6.QtHttpServer.QHttpServerRequest, responder: PySide6.QtHttpServer.QHttpServerResponder) -> bool: ... 250 | def hasValidMethods(self) -> bool: ... 251 | def matches(self, request: PySide6.QtHttpServer.QHttpServerRequest, match: PySide6.QtCore.QRegularExpressionMatch) -> bool: ... 252 | 253 | 254 | class QIntList(object): ... 255 | 256 | 257 | # eof 258 | -------------------------------------------------------------------------------- /PySide6-stubs/QtMultimediaWidgets.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtMultimediaWidgets, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtMultimediaWidgets` 11 | 12 | import PySide6.QtMultimediaWidgets 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | import PySide6.QtMultimedia 17 | 18 | from typing import Any, ClassVar, Optional, Union 19 | from PySide6.QtCore import Signal 20 | from typing import TypeAlias, TypeVar 21 | 22 | 23 | NoneType: TypeAlias = type[None] 24 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 25 | 26 | 27 | class QGraphicsVideoItem(PySide6.QtWidgets.QGraphicsObject): 28 | 29 | nativeSizeChanged : ClassVar[Signal] = ... # nativeSizeChanged(QSizeF) 30 | 31 | def __init__(self, parent: Optional[PySide6.QtWidgets.QGraphicsItem] = ...) -> None: ... 32 | 33 | def aspectRatioMode(self) -> PySide6.QtCore.Qt.AspectRatioMode: ... 34 | def boundingRect(self) -> PySide6.QtCore.QRectF: ... 35 | def itemChange(self, change: PySide6.QtWidgets.QGraphicsItem.GraphicsItemChange, value: Any) -> Any: ... 36 | def nativeSize(self) -> PySide6.QtCore.QSizeF: ... 37 | def offset(self) -> PySide6.QtCore.QPointF: ... 38 | def paint(self, painter: PySide6.QtGui.QPainter, option: PySide6.QtWidgets.QStyleOptionGraphicsItem, widget: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 39 | def setAspectRatioMode(self, mode: PySide6.QtCore.Qt.AspectRatioMode) -> None: ... 40 | def setOffset(self, offset: Union[PySide6.QtCore.QPointF, PySide6.QtCore.QPoint, PySide6.QtGui.QPainterPath.Element]) -> None: ... 41 | def setSize(self, size: Union[PySide6.QtCore.QSizeF, PySide6.QtCore.QSize]) -> None: ... 42 | def size(self) -> PySide6.QtCore.QSizeF: ... 43 | def timerEvent(self, event: PySide6.QtCore.QTimerEvent) -> None: ... 44 | def type(self) -> int: ... 45 | def videoSink(self) -> PySide6.QtMultimedia.QVideoSink: ... 46 | 47 | 48 | class QIntList(object): ... 49 | 50 | 51 | class QVideoWidget(PySide6.QtWidgets.QWidget): 52 | 53 | aspectRatioModeChanged : ClassVar[Signal] = ... # aspectRatioModeChanged(Qt::AspectRatioMode) 54 | fullScreenChanged : ClassVar[Signal] = ... # fullScreenChanged(bool) 55 | 56 | def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 57 | 58 | def aspectRatioMode(self) -> PySide6.QtCore.Qt.AspectRatioMode: ... 59 | def event(self, event: PySide6.QtCore.QEvent) -> bool: ... 60 | def hideEvent(self, event: PySide6.QtGui.QHideEvent) -> None: ... 61 | def moveEvent(self, event: PySide6.QtGui.QMoveEvent) -> None: ... 62 | def resizeEvent(self, event: PySide6.QtGui.QResizeEvent) -> None: ... 63 | def setAspectRatioMode(self, mode: PySide6.QtCore.Qt.AspectRatioMode) -> None: ... 64 | def setFullScreen(self, fullScreen: bool) -> None: ... 65 | def showEvent(self, event: PySide6.QtGui.QShowEvent) -> None: ... 66 | def sizeHint(self) -> PySide6.QtCore.QSize: ... 67 | def videoSink(self) -> PySide6.QtMultimedia.QVideoSink: ... 68 | 69 | 70 | # eof 71 | -------------------------------------------------------------------------------- /PySide6-stubs/QtOpenGLWidgets.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtOpenGLWidgets, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtOpenGLWidgets` 11 | 12 | import PySide6.QtOpenGLWidgets 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | 17 | import enum 18 | from typing import ClassVar, Optional, Union, overload 19 | from PySide6.QtCore import Signal 20 | from typing import TypeAlias, TypeVar 21 | 22 | 23 | NoneType: TypeAlias = type[None] 24 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 25 | 26 | 27 | class QIntList(object): ... 28 | 29 | 30 | class QOpenGLWidget(PySide6.QtWidgets.QWidget): 31 | 32 | aboutToCompose : ClassVar[Signal] = ... # aboutToCompose() 33 | aboutToResize : ClassVar[Signal] = ... # aboutToResize() 34 | frameSwapped : ClassVar[Signal] = ... # frameSwapped() 35 | resized : ClassVar[Signal] = ... # resized() 36 | 37 | class TargetBuffer(enum.Enum): 38 | 39 | LeftBuffer : QOpenGLWidget.TargetBuffer = ... # 0x0 40 | RightBuffer : QOpenGLWidget.TargetBuffer = ... # 0x1 41 | 42 | class UpdateBehavior(enum.Enum): 43 | 44 | NoPartialUpdate : QOpenGLWidget.UpdateBehavior = ... # 0x0 45 | PartialUpdate : QOpenGLWidget.UpdateBehavior = ... # 0x1 46 | 47 | 48 | def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ..., f: PySide6.QtCore.Qt.WindowType = ...) -> None: ... 49 | 50 | def context(self) -> PySide6.QtGui.QOpenGLContext: ... 51 | def currentTargetBuffer(self) -> PySide6.QtOpenGLWidgets.QOpenGLWidget.TargetBuffer: ... 52 | @overload 53 | def defaultFramebufferObject(self) -> int: ... 54 | @overload 55 | def defaultFramebufferObject(self, targetBuffer: PySide6.QtOpenGLWidgets.QOpenGLWidget.TargetBuffer) -> int: ... 56 | def doneCurrent(self) -> None: ... 57 | def event(self, e: PySide6.QtCore.QEvent) -> bool: ... 58 | def format(self) -> PySide6.QtGui.QSurfaceFormat: ... 59 | @overload 60 | def grabFramebuffer(self) -> PySide6.QtGui.QImage: ... 61 | @overload 62 | def grabFramebuffer(self, targetBuffer: PySide6.QtOpenGLWidgets.QOpenGLWidget.TargetBuffer) -> PySide6.QtGui.QImage: ... 63 | def initializeGL(self) -> None: ... 64 | def isValid(self) -> bool: ... 65 | @overload 66 | def makeCurrent(self) -> None: ... 67 | @overload 68 | def makeCurrent(self, targetBuffer: PySide6.QtOpenGLWidgets.QOpenGLWidget.TargetBuffer) -> None: ... 69 | def metric(self, metric: PySide6.QtGui.QPaintDevice.PaintDeviceMetric) -> int: ... 70 | def paintEngine(self) -> PySide6.QtGui.QPaintEngine: ... 71 | def paintEvent(self, e: PySide6.QtGui.QPaintEvent) -> None: ... 72 | def paintGL(self) -> None: ... 73 | def redirected(self, p: PySide6.QtCore.QPoint) -> PySide6.QtGui.QPaintDevice: ... 74 | def resizeEvent(self, e: PySide6.QtGui.QResizeEvent) -> None: ... 75 | def resizeGL(self, w: int, h: int) -> None: ... 76 | def setFormat(self, format: Union[PySide6.QtGui.QSurfaceFormat, PySide6.QtGui.QSurfaceFormat.FormatOption]) -> None: ... 77 | def setTextureFormat(self, texFormat: int) -> None: ... 78 | def setUpdateBehavior(self, updateBehavior: PySide6.QtOpenGLWidgets.QOpenGLWidget.UpdateBehavior) -> None: ... 79 | def textureFormat(self) -> int: ... 80 | def updateBehavior(self) -> PySide6.QtOpenGLWidgets.QOpenGLWidget.UpdateBehavior: ... 81 | 82 | 83 | # eof 84 | -------------------------------------------------------------------------------- /PySide6-stubs/QtPdfWidgets.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtPdfWidgets, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtPdfWidgets` 11 | 12 | import PySide6.QtPdfWidgets 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | import PySide6.QtPdf 17 | 18 | import enum 19 | from typing import ClassVar, overload 20 | from PySide6.QtCore import Signal 21 | from typing import TypeAlias, TypeVar 22 | 23 | 24 | NoneType: TypeAlias = type[None] 25 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 26 | 27 | 28 | class QIntList(object): ... 29 | 30 | 31 | class QPdfPageSelector(PySide6.QtWidgets.QWidget): 32 | 33 | currentPageChanged : ClassVar[Signal] = ... # currentPageChanged(int) 34 | currentPageLabelChanged : ClassVar[Signal] = ... # currentPageLabelChanged(QString) 35 | documentChanged : ClassVar[Signal] = ... # documentChanged(QPdfDocument*) 36 | 37 | @overload 38 | def __init__(self) -> None: ... 39 | @overload 40 | def __init__(self, parent: PySide6.QtWidgets.QWidget) -> None: ... 41 | 42 | def currentPage(self) -> int: ... 43 | def currentPageLabel(self) -> str: ... 44 | def document(self) -> PySide6.QtPdf.QPdfDocument: ... 45 | def setCurrentPage(self, index: int) -> None: ... 46 | def setDocument(self, document: PySide6.QtPdf.QPdfDocument) -> None: ... 47 | 48 | 49 | class QPdfView(PySide6.QtWidgets.QAbstractScrollArea): 50 | 51 | currentSearchResultIndexChanged: ClassVar[Signal] = ... # currentSearchResultIndexChanged(int) 52 | documentChanged : ClassVar[Signal] = ... # documentChanged(QPdfDocument*) 53 | documentMarginsChanged : ClassVar[Signal] = ... # documentMarginsChanged(QMargins) 54 | pageModeChanged : ClassVar[Signal] = ... # pageModeChanged(QPdfView::PageMode) 55 | pageSpacingChanged : ClassVar[Signal] = ... # pageSpacingChanged(int) 56 | searchModelChanged : ClassVar[Signal] = ... # searchModelChanged(QPdfSearchModel*) 57 | zoomFactorChanged : ClassVar[Signal] = ... # zoomFactorChanged(double) 58 | zoomModeChanged : ClassVar[Signal] = ... # zoomModeChanged(QPdfView::ZoomMode) 59 | 60 | class PageMode(enum.Enum): 61 | 62 | SinglePage : QPdfView.PageMode = ... # 0x0 63 | MultiPage : QPdfView.PageMode = ... # 0x1 64 | 65 | class ZoomMode(enum.Enum): 66 | 67 | Custom : QPdfView.ZoomMode = ... # 0x0 68 | FitToWidth : QPdfView.ZoomMode = ... # 0x1 69 | FitInView : QPdfView.ZoomMode = ... # 0x2 70 | 71 | 72 | @overload 73 | def __init__(self) -> None: ... 74 | @overload 75 | def __init__(self, parent: PySide6.QtWidgets.QWidget) -> None: ... 76 | 77 | def currentSearchResultIndex(self) -> int: ... 78 | def document(self) -> PySide6.QtPdf.QPdfDocument: ... 79 | def documentMargins(self) -> PySide6.QtCore.QMargins: ... 80 | def mouseMoveEvent(self, event: PySide6.QtGui.QMouseEvent) -> None: ... 81 | def mousePressEvent(self, event: PySide6.QtGui.QMouseEvent) -> None: ... 82 | def mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) -> None: ... 83 | def pageMode(self) -> PySide6.QtPdfWidgets.QPdfView.PageMode: ... 84 | def pageNavigator(self) -> PySide6.QtPdf.QPdfPageNavigator: ... 85 | def pageSpacing(self) -> int: ... 86 | def paintEvent(self, event: PySide6.QtGui.QPaintEvent) -> None: ... 87 | def resizeEvent(self, event: PySide6.QtGui.QResizeEvent) -> None: ... 88 | def scrollContentsBy(self, dx: int, dy: int) -> None: ... 89 | def searchModel(self) -> PySide6.QtPdf.QPdfSearchModel: ... 90 | def setCurrentSearchResultIndex(self, currentResult: int) -> None: ... 91 | def setDocument(self, document: PySide6.QtPdf.QPdfDocument) -> None: ... 92 | def setDocumentMargins(self, margins: PySide6.QtCore.QMargins) -> None: ... 93 | def setPageMode(self, mode: PySide6.QtPdfWidgets.QPdfView.PageMode) -> None: ... 94 | def setPageSpacing(self, spacing: int) -> None: ... 95 | def setSearchModel(self, searchModel: PySide6.QtPdf.QPdfSearchModel) -> None: ... 96 | def setZoomFactor(self, factor: float) -> None: ... 97 | def setZoomMode(self, mode: PySide6.QtPdfWidgets.QPdfView.ZoomMode) -> None: ... 98 | def zoomFactor(self) -> float: ... 99 | def zoomMode(self) -> PySide6.QtPdfWidgets.QPdfView.ZoomMode: ... 100 | 101 | 102 | # eof 103 | -------------------------------------------------------------------------------- /PySide6-stubs/QtQuickControls2.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtQuickControls2, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtQuickControls2` 11 | 12 | import PySide6.QtQuickControls2 13 | import PySide6.QtCore 14 | 15 | from typing import List, Optional 16 | from shiboken6 import Shiboken 17 | from typing import TypeAlias, TypeVar 18 | 19 | 20 | NoneType: TypeAlias = type[None] 21 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 22 | 23 | 24 | class QIntList(object): ... 25 | 26 | 27 | class QQuickAttachedPropertyPropagator(PySide6.QtCore.QObject): 28 | 29 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 30 | 31 | def attachedChildren(self) -> List[PySide6.QtQuickControls2.QQuickAttachedPropertyPropagator]: ... 32 | def attachedParent(self) -> PySide6.QtQuickControls2.QQuickAttachedPropertyPropagator: ... 33 | def attachedParentChange(self, newParent: PySide6.QtQuickControls2.QQuickAttachedPropertyPropagator, oldParent: PySide6.QtQuickControls2.QQuickAttachedPropertyPropagator) -> None: ... 34 | def initialize(self) -> None: ... 35 | 36 | 37 | class QQuickStyle(Shiboken.Object): 38 | 39 | def __init__(self) -> None: ... 40 | 41 | @staticmethod 42 | def name() -> str: ... 43 | @staticmethod 44 | def setFallbackStyle(style: str) -> None: ... 45 | @staticmethod 46 | def setStyle(style: str) -> None: ... 47 | 48 | 49 | # eof 50 | -------------------------------------------------------------------------------- /PySide6-stubs/QtQuickTest.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtQuickTest, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtQuickTest` 11 | 12 | import PySide6.QtQuickTest 13 | 14 | from typing import Sequence 15 | from typing import TypeAlias, TypeVar 16 | 17 | 18 | NoneType: TypeAlias = type[None] 19 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 20 | 21 | 22 | class QIntList(object): ... 23 | 24 | 25 | def QUICK_TEST_MAIN(name: str, argv: Sequence[str] = ..., dir: str = ...) -> int: ... 26 | def QUICK_TEST_MAIN_WITH_SETUP(name: str, setup: type, argv: Sequence[str] = ..., dir: str = ...) -> int: ... 27 | 28 | 29 | # eof 30 | -------------------------------------------------------------------------------- /PySide6-stubs/QtQuickWidgets.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtQuickWidgets, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtQuickWidgets` 11 | 12 | import PySide6.QtQuickWidgets 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | import PySide6.QtQml 17 | import PySide6.QtQuick 18 | 19 | import enum 20 | from typing import Any, ClassVar, List, Optional, Union, overload 21 | from PySide6.QtCore import Signal 22 | from typing import TypeAlias, TypeVar 23 | 24 | 25 | NoneType: TypeAlias = type[None] 26 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 27 | 28 | 29 | class QIntList(object): ... 30 | 31 | 32 | class QQuickWidget(PySide6.QtWidgets.QWidget): 33 | 34 | sceneGraphError : ClassVar[Signal] = ... # sceneGraphError(QQuickWindow::SceneGraphError,QString) 35 | statusChanged : ClassVar[Signal] = ... # statusChanged(QQuickWidget::Status) 36 | 37 | class ResizeMode(enum.Enum): 38 | 39 | SizeViewToRootObject : QQuickWidget.ResizeMode = ... # 0x0 40 | SizeRootObjectToView : QQuickWidget.ResizeMode = ... # 0x1 41 | 42 | class Status(enum.Enum): 43 | 44 | Null : QQuickWidget.Status = ... # 0x0 45 | Ready : QQuickWidget.Status = ... # 0x1 46 | Loading : QQuickWidget.Status = ... # 0x2 47 | Error : QQuickWidget.Status = ... # 0x3 48 | 49 | 50 | @overload 51 | def __init__(self, engine: PySide6.QtQml.QQmlEngine, parent: PySide6.QtWidgets.QWidget) -> None: ... 52 | @overload 53 | def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 54 | @overload 55 | def __init__(self, source: Union[PySide6.QtCore.QUrl, str], parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 56 | 57 | def dragEnterEvent(self, arg__1: PySide6.QtGui.QDragEnterEvent) -> None: ... 58 | def dragLeaveEvent(self, arg__1: PySide6.QtGui.QDragLeaveEvent) -> None: ... 59 | def dragMoveEvent(self, arg__1: PySide6.QtGui.QDragMoveEvent) -> None: ... 60 | def dropEvent(self, arg__1: PySide6.QtGui.QDropEvent) -> None: ... 61 | def engine(self) -> PySide6.QtQml.QQmlEngine: ... 62 | def errors(self) -> List[PySide6.QtQml.QQmlError]: ... 63 | def event(self, arg__1: PySide6.QtCore.QEvent) -> bool: ... 64 | def focusInEvent(self, event: PySide6.QtGui.QFocusEvent) -> None: ... 65 | def focusNextPrevChild(self, next: bool) -> bool: ... 66 | def focusOutEvent(self, event: PySide6.QtGui.QFocusEvent) -> None: ... 67 | def format(self) -> PySide6.QtGui.QSurfaceFormat: ... 68 | def grabFramebuffer(self) -> PySide6.QtGui.QImage: ... 69 | def hideEvent(self, arg__1: PySide6.QtGui.QHideEvent) -> None: ... 70 | def initialSize(self) -> PySide6.QtCore.QSize: ... 71 | def keyPressEvent(self, arg__1: PySide6.QtGui.QKeyEvent) -> None: ... 72 | def keyReleaseEvent(self, arg__1: PySide6.QtGui.QKeyEvent) -> None: ... 73 | def mouseDoubleClickEvent(self, arg__1: PySide6.QtGui.QMouseEvent) -> None: ... 74 | def mouseMoveEvent(self, arg__1: PySide6.QtGui.QMouseEvent) -> None: ... 75 | def mousePressEvent(self, arg__1: PySide6.QtGui.QMouseEvent) -> None: ... 76 | def mouseReleaseEvent(self, arg__1: PySide6.QtGui.QMouseEvent) -> None: ... 77 | def paintEvent(self, event: PySide6.QtGui.QPaintEvent) -> None: ... 78 | def quickWindow(self) -> PySide6.QtQuick.QQuickWindow: ... 79 | def resizeEvent(self, arg__1: PySide6.QtGui.QResizeEvent) -> None: ... 80 | def resizeMode(self) -> PySide6.QtQuickWidgets.QQuickWidget.ResizeMode: ... 81 | def rootContext(self) -> PySide6.QtQml.QQmlContext: ... 82 | def rootObject(self) -> PySide6.QtQuick.QQuickItem: ... 83 | def setClearColor(self, color: Union[PySide6.QtGui.QColor, str, PySide6.QtGui.QRgba64, Any, PySide6.QtCore.Qt.GlobalColor, int]) -> None: ... 84 | def setContent(self, url: Union[PySide6.QtCore.QUrl, str], component: PySide6.QtQml.QQmlComponent, item: PySide6.QtCore.QObject) -> None: ... 85 | def setFormat(self, format: Union[PySide6.QtGui.QSurfaceFormat, PySide6.QtGui.QSurfaceFormat.FormatOption]) -> None: ... 86 | def setResizeMode(self, arg__1: PySide6.QtQuickWidgets.QQuickWidget.ResizeMode) -> None: ... 87 | def setSource(self, arg__1: Union[PySide6.QtCore.QUrl, str]) -> None: ... 88 | def showEvent(self, arg__1: PySide6.QtGui.QShowEvent) -> None: ... 89 | def sizeHint(self) -> PySide6.QtCore.QSize: ... 90 | def source(self) -> PySide6.QtCore.QUrl: ... 91 | def status(self) -> PySide6.QtQuickWidgets.QQuickWidget.Status: ... 92 | def timerEvent(self, arg__1: PySide6.QtCore.QTimerEvent) -> None: ... 93 | def wheelEvent(self, arg__1: PySide6.QtGui.QWheelEvent) -> None: ... 94 | 95 | 96 | # eof 97 | -------------------------------------------------------------------------------- /PySide6-stubs/QtSerialPort.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtSerialPort, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtSerialPort` 11 | 12 | import PySide6.QtSerialPort 13 | import PySide6.QtCore 14 | 15 | import enum 16 | from typing import ClassVar, List, Optional, Union, overload 17 | from PySide6.QtCore import Signal 18 | from shiboken6 import Shiboken 19 | from typing import TypeAlias, TypeVar 20 | 21 | 22 | NoneType: TypeAlias = type[None] 23 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 24 | 25 | 26 | class QIntList(object): ... 27 | 28 | 29 | class QSerialPort(PySide6.QtCore.QIODevice): 30 | 31 | baudRateChanged : ClassVar[Signal] = ... # baudRateChanged(int,QSerialPort::Directions) 32 | breakEnabledChanged : ClassVar[Signal] = ... # breakEnabledChanged(bool) 33 | dataBitsChanged : ClassVar[Signal] = ... # dataBitsChanged(QSerialPort::DataBits) 34 | dataTerminalReadyChanged : ClassVar[Signal] = ... # dataTerminalReadyChanged(bool) 35 | errorOccurred : ClassVar[Signal] = ... # errorOccurred(QSerialPort::SerialPortError) 36 | flowControlChanged : ClassVar[Signal] = ... # flowControlChanged(QSerialPort::FlowControl) 37 | parityChanged : ClassVar[Signal] = ... # parityChanged(QSerialPort::Parity) 38 | requestToSendChanged : ClassVar[Signal] = ... # requestToSendChanged(bool) 39 | stopBitsChanged : ClassVar[Signal] = ... # stopBitsChanged(QSerialPort::StopBits) 40 | 41 | class BaudRate(enum.IntEnum): 42 | 43 | Baud1200 : QSerialPort.BaudRate = ... # 0x4b0 44 | Baud2400 : QSerialPort.BaudRate = ... # 0x960 45 | Baud4800 : QSerialPort.BaudRate = ... # 0x12c0 46 | Baud9600 : QSerialPort.BaudRate = ... # 0x2580 47 | Baud19200 : QSerialPort.BaudRate = ... # 0x4b00 48 | Baud38400 : QSerialPort.BaudRate = ... # 0x9600 49 | Baud57600 : QSerialPort.BaudRate = ... # 0xe100 50 | Baud115200 : QSerialPort.BaudRate = ... # 0x1c200 51 | 52 | class DataBits(enum.Enum): 53 | 54 | Data5 : QSerialPort.DataBits = ... # 0x5 55 | Data6 : QSerialPort.DataBits = ... # 0x6 56 | Data7 : QSerialPort.DataBits = ... # 0x7 57 | Data8 : QSerialPort.DataBits = ... # 0x8 58 | 59 | class Direction(enum.Flag): 60 | 61 | Input : QSerialPort.Direction = ... # 0x1 62 | Output : QSerialPort.Direction = ... # 0x2 63 | AllDirections : QSerialPort.Direction = ... # 0x3 64 | 65 | class FlowControl(enum.Enum): 66 | 67 | NoFlowControl : QSerialPort.FlowControl = ... # 0x0 68 | HardwareControl : QSerialPort.FlowControl = ... # 0x1 69 | SoftwareControl : QSerialPort.FlowControl = ... # 0x2 70 | 71 | class Parity(enum.Enum): 72 | 73 | NoParity : QSerialPort.Parity = ... # 0x0 74 | EvenParity : QSerialPort.Parity = ... # 0x2 75 | OddParity : QSerialPort.Parity = ... # 0x3 76 | SpaceParity : QSerialPort.Parity = ... # 0x4 77 | MarkParity : QSerialPort.Parity = ... # 0x5 78 | 79 | class PinoutSignal(enum.Flag): 80 | 81 | NoSignal : QSerialPort.PinoutSignal = ... # 0x0 82 | DataTerminalReadySignal : QSerialPort.PinoutSignal = ... # 0x4 83 | DataCarrierDetectSignal : QSerialPort.PinoutSignal = ... # 0x8 84 | DataSetReadySignal : QSerialPort.PinoutSignal = ... # 0x10 85 | RingIndicatorSignal : QSerialPort.PinoutSignal = ... # 0x20 86 | RequestToSendSignal : QSerialPort.PinoutSignal = ... # 0x40 87 | ClearToSendSignal : QSerialPort.PinoutSignal = ... # 0x80 88 | SecondaryTransmittedDataSignal: QSerialPort.PinoutSignal = ... # 0x100 89 | SecondaryReceivedDataSignal: QSerialPort.PinoutSignal = ... # 0x200 90 | 91 | class SerialPortError(enum.Enum): 92 | 93 | NoError : QSerialPort.SerialPortError = ... # 0x0 94 | DeviceNotFoundError : QSerialPort.SerialPortError = ... # 0x1 95 | PermissionError : QSerialPort.SerialPortError = ... # 0x2 96 | OpenError : QSerialPort.SerialPortError = ... # 0x3 97 | WriteError : QSerialPort.SerialPortError = ... # 0x4 98 | ReadError : QSerialPort.SerialPortError = ... # 0x5 99 | ResourceError : QSerialPort.SerialPortError = ... # 0x6 100 | UnsupportedOperationError: QSerialPort.SerialPortError = ... # 0x7 101 | UnknownError : QSerialPort.SerialPortError = ... # 0x8 102 | TimeoutError : QSerialPort.SerialPortError = ... # 0x9 103 | NotOpenError : QSerialPort.SerialPortError = ... # 0xa 104 | 105 | class StopBits(enum.Enum): 106 | 107 | OneStop : QSerialPort.StopBits = ... # 0x1 108 | TwoStop : QSerialPort.StopBits = ... # 0x2 109 | OneAndHalfStop : QSerialPort.StopBits = ... # 0x3 110 | 111 | 112 | @overload 113 | def __init__(self, info: PySide6.QtSerialPort.QSerialPortInfo, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 114 | @overload 115 | def __init__(self, name: str, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 116 | @overload 117 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 118 | 119 | def baudRate(self, directions: PySide6.QtSerialPort.QSerialPort.Direction = ...) -> int: ... 120 | def bytesAvailable(self) -> int: ... 121 | def bytesToWrite(self) -> int: ... 122 | def canReadLine(self) -> bool: ... 123 | def clear(self, directions: PySide6.QtSerialPort.QSerialPort.Direction = ...) -> bool: ... 124 | def clearError(self) -> None: ... 125 | def close(self) -> None: ... 126 | def dataBits(self) -> PySide6.QtSerialPort.QSerialPort.DataBits: ... 127 | def error(self) -> PySide6.QtSerialPort.QSerialPort.SerialPortError: ... 128 | def flowControl(self) -> PySide6.QtSerialPort.QSerialPort.FlowControl: ... 129 | def flush(self) -> bool: ... 130 | def handle(self) -> int: ... 131 | def isBreakEnabled(self) -> bool: ... 132 | def isDataTerminalReady(self) -> bool: ... 133 | def isRequestToSend(self) -> bool: ... 134 | def isSequential(self) -> bool: ... 135 | def open(self, mode: PySide6.QtCore.QIODeviceBase.OpenModeFlag) -> bool: ... 136 | def parity(self) -> PySide6.QtSerialPort.QSerialPort.Parity: ... 137 | def pinoutSignals(self) -> PySide6.QtSerialPort.QSerialPort.PinoutSignal: ... 138 | def portName(self) -> str: ... 139 | def readBufferSize(self) -> int: ... 140 | def readData(self, maxSize: int) -> object: ... 141 | def readLineData(self, maxSize: int) -> object: ... 142 | def setBaudRate(self, baudRate: int, directions: PySide6.QtSerialPort.QSerialPort.Direction = ...) -> bool: ... 143 | def setBreakEnabled(self, set: bool = ...) -> bool: ... 144 | def setDataBits(self, dataBits: PySide6.QtSerialPort.QSerialPort.DataBits) -> bool: ... 145 | def setDataTerminalReady(self, set: bool) -> bool: ... 146 | def setFlowControl(self, flowControl: PySide6.QtSerialPort.QSerialPort.FlowControl) -> bool: ... 147 | def setParity(self, parity: PySide6.QtSerialPort.QSerialPort.Parity) -> bool: ... 148 | def setPort(self, info: PySide6.QtSerialPort.QSerialPortInfo) -> None: ... 149 | def setPortName(self, name: str) -> None: ... 150 | def setReadBufferSize(self, size: int) -> None: ... 151 | def setRequestToSend(self, set: bool) -> bool: ... 152 | def setStopBits(self, stopBits: PySide6.QtSerialPort.QSerialPort.StopBits) -> bool: ... 153 | def stopBits(self) -> PySide6.QtSerialPort.QSerialPort.StopBits: ... 154 | def waitForBytesWritten(self, msecs: int = ...) -> bool: ... 155 | def waitForReadyRead(self, msecs: int = ...) -> bool: ... 156 | def writeData(self, data: Union[bytes, bytearray, memoryview], maxSize: int) -> int: ... 157 | 158 | 159 | class QSerialPortInfo(Shiboken.Object): 160 | 161 | @overload 162 | def __init__(self) -> None: ... 163 | @overload 164 | def __init__(self, name: str) -> None: ... 165 | @overload 166 | def __init__(self, other: PySide6.QtSerialPort.QSerialPortInfo) -> None: ... 167 | @overload 168 | def __init__(self, port: PySide6.QtSerialPort.QSerialPort) -> None: ... 169 | 170 | @staticmethod 171 | def __copy__() -> None: ... 172 | @staticmethod 173 | def availablePorts() -> List[PySide6.QtSerialPort.QSerialPortInfo]: ... 174 | def description(self) -> str: ... 175 | def hasProductIdentifier(self) -> bool: ... 176 | def hasVendorIdentifier(self) -> bool: ... 177 | def isNull(self) -> bool: ... 178 | def manufacturer(self) -> str: ... 179 | def portName(self) -> str: ... 180 | def productIdentifier(self) -> int: ... 181 | def serialNumber(self) -> str: ... 182 | @staticmethod 183 | def standardBaudRates() -> List[int]: ... 184 | def swap(self, other: PySide6.QtSerialPort.QSerialPortInfo) -> None: ... 185 | def systemLocation(self) -> str: ... 186 | def vendorIdentifier(self) -> int: ... 187 | 188 | 189 | # eof 190 | -------------------------------------------------------------------------------- /PySide6-stubs/QtSpatialAudio.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtSpatialAudio, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtSpatialAudio` 11 | 12 | import PySide6.QtSpatialAudio 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtMultimedia 16 | 17 | import enum 18 | from typing import ClassVar, Optional, Union, overload 19 | from PySide6.QtCore import Signal 20 | from typing import TypeAlias, TypeVar 21 | 22 | 23 | NoneType: TypeAlias = type[None] 24 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 25 | 26 | 27 | class QAmbientSound(PySide6.QtCore.QObject): 28 | 29 | autoPlayChanged : ClassVar[Signal] = ... # autoPlayChanged() 30 | loopsChanged : ClassVar[Signal] = ... # loopsChanged() 31 | sourceChanged : ClassVar[Signal] = ... # sourceChanged() 32 | volumeChanged : ClassVar[Signal] = ... # volumeChanged() 33 | 34 | class Loops(enum.Enum): 35 | 36 | Infinite : QAmbientSound.Loops = ... # -0x1 37 | Once : QAmbientSound.Loops = ... # 0x1 38 | 39 | 40 | def __init__(self, engine: PySide6.QtSpatialAudio.QAudioEngine) -> None: ... 41 | 42 | def autoPlay(self) -> bool: ... 43 | def engine(self) -> PySide6.QtSpatialAudio.QAudioEngine: ... 44 | def loops(self) -> int: ... 45 | def pause(self) -> None: ... 46 | def play(self) -> None: ... 47 | def setAutoPlay(self, autoPlay: bool) -> None: ... 48 | def setLoops(self, loops: int) -> None: ... 49 | def setSource(self, url: Union[PySide6.QtCore.QUrl, str]) -> None: ... 50 | def setVolume(self, volume: float) -> None: ... 51 | def source(self) -> PySide6.QtCore.QUrl: ... 52 | def stop(self) -> None: ... 53 | def volume(self) -> float: ... 54 | 55 | 56 | class QAudioEngine(PySide6.QtCore.QObject): 57 | 58 | distanceScaleChanged : ClassVar[Signal] = ... # distanceScaleChanged() 59 | masterVolumeChanged : ClassVar[Signal] = ... # masterVolumeChanged() 60 | outputDeviceChanged : ClassVar[Signal] = ... # outputDeviceChanged() 61 | outputModeChanged : ClassVar[Signal] = ... # outputModeChanged() 62 | pausedChanged : ClassVar[Signal] = ... # pausedChanged() 63 | 64 | class OutputMode(enum.Enum): 65 | 66 | Surround : QAudioEngine.OutputMode = ... # 0x0 67 | Stereo : QAudioEngine.OutputMode = ... # 0x1 68 | Headphone : QAudioEngine.OutputMode = ... # 0x2 69 | 70 | 71 | @overload 72 | def __init__(self) -> None: ... 73 | @overload 74 | def __init__(self, parent: PySide6.QtCore.QObject) -> None: ... 75 | @overload 76 | def __init__(self, sampleRate: int, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 77 | 78 | def distanceScale(self) -> float: ... 79 | def masterVolume(self) -> float: ... 80 | def outputDevice(self) -> PySide6.QtMultimedia.QAudioDevice: ... 81 | def outputMode(self) -> PySide6.QtSpatialAudio.QAudioEngine.OutputMode: ... 82 | def pause(self) -> None: ... 83 | def paused(self) -> bool: ... 84 | def resume(self) -> None: ... 85 | def roomEffectsEnabled(self) -> bool: ... 86 | def sampleRate(self) -> int: ... 87 | def setDistanceScale(self, scale: float) -> None: ... 88 | def setMasterVolume(self, volume: float) -> None: ... 89 | def setOutputDevice(self, device: PySide6.QtMultimedia.QAudioDevice) -> None: ... 90 | def setOutputMode(self, mode: PySide6.QtSpatialAudio.QAudioEngine.OutputMode) -> None: ... 91 | def setPaused(self, paused: bool) -> None: ... 92 | def setRoomEffectsEnabled(self, enabled: bool) -> None: ... 93 | def start(self) -> None: ... 94 | def stop(self) -> None: ... 95 | 96 | 97 | class QAudioListener(PySide6.QtCore.QObject): 98 | 99 | def __init__(self, engine: PySide6.QtSpatialAudio.QAudioEngine) -> None: ... 100 | 101 | def engine(self) -> PySide6.QtSpatialAudio.QAudioEngine: ... 102 | def position(self) -> PySide6.QtGui.QVector3D: ... 103 | def rotation(self) -> PySide6.QtGui.QQuaternion: ... 104 | def setPosition(self, pos: PySide6.QtGui.QVector3D) -> None: ... 105 | def setRotation(self, q: PySide6.QtGui.QQuaternion) -> None: ... 106 | 107 | 108 | class QAudioRoom(PySide6.QtCore.QObject): 109 | 110 | dimensionsChanged : ClassVar[Signal] = ... # dimensionsChanged() 111 | positionChanged : ClassVar[Signal] = ... # positionChanged() 112 | reflectionGainChanged : ClassVar[Signal] = ... # reflectionGainChanged() 113 | reverbBrightnessChanged : ClassVar[Signal] = ... # reverbBrightnessChanged() 114 | reverbGainChanged : ClassVar[Signal] = ... # reverbGainChanged() 115 | reverbTimeChanged : ClassVar[Signal] = ... # reverbTimeChanged() 116 | rotationChanged : ClassVar[Signal] = ... # rotationChanged() 117 | wallsChanged : ClassVar[Signal] = ... # wallsChanged() 118 | 119 | class Material(enum.Enum): 120 | 121 | Transparent : QAudioRoom.Material = ... # 0x0 122 | AcousticCeilingTiles : QAudioRoom.Material = ... # 0x1 123 | BrickBare : QAudioRoom.Material = ... # 0x2 124 | BrickPainted : QAudioRoom.Material = ... # 0x3 125 | ConcreteBlockCoarse : QAudioRoom.Material = ... # 0x4 126 | ConcreteBlockPainted : QAudioRoom.Material = ... # 0x5 127 | CurtainHeavy : QAudioRoom.Material = ... # 0x6 128 | FiberGlassInsulation : QAudioRoom.Material = ... # 0x7 129 | GlassThin : QAudioRoom.Material = ... # 0x8 130 | GlassThick : QAudioRoom.Material = ... # 0x9 131 | Grass : QAudioRoom.Material = ... # 0xa 132 | LinoleumOnConcrete : QAudioRoom.Material = ... # 0xb 133 | Marble : QAudioRoom.Material = ... # 0xc 134 | Metal : QAudioRoom.Material = ... # 0xd 135 | ParquetOnConcrete : QAudioRoom.Material = ... # 0xe 136 | PlasterRough : QAudioRoom.Material = ... # 0xf 137 | PlasterSmooth : QAudioRoom.Material = ... # 0x10 138 | PlywoodPanel : QAudioRoom.Material = ... # 0x11 139 | PolishedConcreteOrTile : QAudioRoom.Material = ... # 0x12 140 | Sheetrock : QAudioRoom.Material = ... # 0x13 141 | WaterOrIceSurface : QAudioRoom.Material = ... # 0x14 142 | WoodCeiling : QAudioRoom.Material = ... # 0x15 143 | WoodPanel : QAudioRoom.Material = ... # 0x16 144 | UniformMaterial : QAudioRoom.Material = ... # 0x17 145 | 146 | class Wall(enum.Enum): 147 | 148 | LeftWall : QAudioRoom.Wall = ... # 0x0 149 | RightWall : QAudioRoom.Wall = ... # 0x1 150 | Floor : QAudioRoom.Wall = ... # 0x2 151 | Ceiling : QAudioRoom.Wall = ... # 0x3 152 | FrontWall : QAudioRoom.Wall = ... # 0x4 153 | BackWall : QAudioRoom.Wall = ... # 0x5 154 | 155 | 156 | def __init__(self, engine: PySide6.QtSpatialAudio.QAudioEngine) -> None: ... 157 | 158 | def dimensions(self) -> PySide6.QtGui.QVector3D: ... 159 | def position(self) -> PySide6.QtGui.QVector3D: ... 160 | def reflectionGain(self) -> float: ... 161 | def reverbBrightness(self) -> float: ... 162 | def reverbGain(self) -> float: ... 163 | def reverbTime(self) -> float: ... 164 | def rotation(self) -> PySide6.QtGui.QQuaternion: ... 165 | def setDimensions(self, dim: PySide6.QtGui.QVector3D) -> None: ... 166 | def setPosition(self, pos: PySide6.QtGui.QVector3D) -> None: ... 167 | def setReflectionGain(self, factor: float) -> None: ... 168 | def setReverbBrightness(self, factor: float) -> None: ... 169 | def setReverbGain(self, factor: float) -> None: ... 170 | def setReverbTime(self, factor: float) -> None: ... 171 | def setRotation(self, q: PySide6.QtGui.QQuaternion) -> None: ... 172 | def setWallMaterial(self, wall: PySide6.QtSpatialAudio.QAudioRoom.Wall, material: PySide6.QtSpatialAudio.QAudioRoom.Material) -> None: ... 173 | def wallMaterial(self, wall: PySide6.QtSpatialAudio.QAudioRoom.Wall) -> PySide6.QtSpatialAudio.QAudioRoom.Material: ... 174 | 175 | 176 | class QIntList(object): ... 177 | 178 | 179 | class QSpatialSound(PySide6.QtCore.QObject): 180 | 181 | autoPlayChanged : ClassVar[Signal] = ... # autoPlayChanged() 182 | directivityChanged : ClassVar[Signal] = ... # directivityChanged() 183 | directivityOrderChanged : ClassVar[Signal] = ... # directivityOrderChanged() 184 | distanceCutoffChanged : ClassVar[Signal] = ... # distanceCutoffChanged() 185 | distanceModelChanged : ClassVar[Signal] = ... # distanceModelChanged() 186 | loopsChanged : ClassVar[Signal] = ... # loopsChanged() 187 | manualAttenuationChanged : ClassVar[Signal] = ... # manualAttenuationChanged() 188 | nearFieldGainChanged : ClassVar[Signal] = ... # nearFieldGainChanged() 189 | occlusionIntensityChanged: ClassVar[Signal] = ... # occlusionIntensityChanged() 190 | positionChanged : ClassVar[Signal] = ... # positionChanged() 191 | rotationChanged : ClassVar[Signal] = ... # rotationChanged() 192 | sizeChanged : ClassVar[Signal] = ... # sizeChanged() 193 | sourceChanged : ClassVar[Signal] = ... # sourceChanged() 194 | volumeChanged : ClassVar[Signal] = ... # volumeChanged() 195 | 196 | class DistanceModel(enum.Enum): 197 | 198 | Logarithmic : QSpatialSound.DistanceModel = ... # 0x0 199 | Linear : QSpatialSound.DistanceModel = ... # 0x1 200 | ManualAttenuation : QSpatialSound.DistanceModel = ... # 0x2 201 | 202 | class Loops(enum.Enum): 203 | 204 | Infinite : QSpatialSound.Loops = ... # -0x1 205 | Once : QSpatialSound.Loops = ... # 0x1 206 | 207 | 208 | def __init__(self, engine: PySide6.QtSpatialAudio.QAudioEngine) -> None: ... 209 | 210 | def autoPlay(self) -> bool: ... 211 | def directivity(self) -> float: ... 212 | def directivityOrder(self) -> float: ... 213 | def distanceCutoff(self) -> float: ... 214 | def distanceModel(self) -> PySide6.QtSpatialAudio.QSpatialSound.DistanceModel: ... 215 | def engine(self) -> PySide6.QtSpatialAudio.QAudioEngine: ... 216 | def loops(self) -> int: ... 217 | def manualAttenuation(self) -> float: ... 218 | def nearFieldGain(self) -> float: ... 219 | def occlusionIntensity(self) -> float: ... 220 | def pause(self) -> None: ... 221 | def play(self) -> None: ... 222 | def position(self) -> PySide6.QtGui.QVector3D: ... 223 | def rotation(self) -> PySide6.QtGui.QQuaternion: ... 224 | def setAutoPlay(self, autoPlay: bool) -> None: ... 225 | def setDirectivity(self, alpha: float) -> None: ... 226 | def setDirectivityOrder(self, alpha: float) -> None: ... 227 | def setDistanceCutoff(self, cutoff: float) -> None: ... 228 | def setDistanceModel(self, model: PySide6.QtSpatialAudio.QSpatialSound.DistanceModel) -> None: ... 229 | def setLoops(self, loops: int) -> None: ... 230 | def setManualAttenuation(self, attenuation: float) -> None: ... 231 | def setNearFieldGain(self, gain: float) -> None: ... 232 | def setOcclusionIntensity(self, occlusion: float) -> None: ... 233 | def setPosition(self, pos: PySide6.QtGui.QVector3D) -> None: ... 234 | def setRotation(self, q: PySide6.QtGui.QQuaternion) -> None: ... 235 | def setSize(self, size: float) -> None: ... 236 | def setSource(self, url: Union[PySide6.QtCore.QUrl, str]) -> None: ... 237 | def setVolume(self, volume: float) -> None: ... 238 | def size(self) -> float: ... 239 | def source(self) -> PySide6.QtCore.QUrl: ... 240 | def stop(self) -> None: ... 241 | def volume(self) -> float: ... 242 | 243 | 244 | # eof 245 | -------------------------------------------------------------------------------- /PySide6-stubs/QtSvg.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtSvg, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtSvg` 11 | 12 | import PySide6.QtSvg 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | 16 | import enum 17 | from typing import ClassVar, Generator, IO, Optional, Union, overload 18 | from PySide6.QtCore import Signal 19 | from shiboken6 import Shiboken 20 | from typing import TypeAlias, TypeVar 21 | 22 | 23 | NoneType: TypeAlias = type[None] 24 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 25 | 26 | 27 | class QIntList(object): ... 28 | 29 | 30 | class QSvgGenerator(PySide6.QtGui.QPaintDevice): 31 | 32 | class SvgVersion(enum.Enum): 33 | 34 | SvgTiny12 : QSvgGenerator.SvgVersion = ... # 0x0 35 | Svg11 : QSvgGenerator.SvgVersion = ... # 0x1 36 | 37 | 38 | @overload 39 | def __init__(self) -> None: ... 40 | @overload 41 | def __init__(self, version: PySide6.QtSvg.QSvgGenerator.SvgVersion) -> None: ... 42 | 43 | def description(self) -> str: ... 44 | def fileName(self) -> str: ... 45 | def metric(self, metric: PySide6.QtGui.QPaintDevice.PaintDeviceMetric) -> int: ... 46 | def outputDevice(self) -> PySide6.QtCore.QIODevice: ... 47 | def paintEngine(self) -> PySide6.QtGui.QPaintEngine: ... 48 | def resolution(self) -> int: ... 49 | def setDescription(self, description: str) -> None: ... 50 | def setFileName(self, fileName: str) -> None: ... 51 | def setOutputDevice(self, outputDevice: PySide6.QtCore.QIODevice) -> None: ... 52 | def setResolution(self, dpi: int) -> None: ... 53 | def setSize(self, size: PySide6.QtCore.QSize) -> None: ... 54 | def setTitle(self, title: str) -> None: ... 55 | @overload 56 | def setViewBox(self, viewBox: PySide6.QtCore.QRect) -> None: ... 57 | @overload 58 | def setViewBox(self, viewBox: Union[PySide6.QtCore.QRectF, PySide6.QtCore.QRect]) -> None: ... 59 | def size(self) -> PySide6.QtCore.QSize: ... 60 | def svgVersion(self) -> PySide6.QtSvg.QSvgGenerator.SvgVersion: ... 61 | def title(self) -> str: ... 62 | def viewBox(self) -> PySide6.QtCore.QRect: ... 63 | def viewBoxF(self) -> PySide6.QtCore.QRectF: ... 64 | 65 | 66 | class QSvgRenderer(PySide6.QtCore.QObject): 67 | 68 | repaintNeeded : ClassVar[Signal] = ... # repaintNeeded() 69 | 70 | @overload 71 | def __init__(self, contents: PySide6.QtCore.QXmlStreamReader, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 72 | @overload 73 | def __init__(self, contents: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 74 | @overload 75 | def __init__(self, filename: str, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 76 | @overload 77 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 78 | 79 | def animated(self) -> bool: ... 80 | def animationDuration(self) -> int: ... 81 | def aspectRatioMode(self) -> PySide6.QtCore.Qt.AspectRatioMode: ... 82 | def boundsOnElement(self, id: str) -> PySide6.QtCore.QRectF: ... 83 | def currentFrame(self) -> int: ... 84 | def defaultSize(self) -> PySide6.QtCore.QSize: ... 85 | def elementExists(self, id: str) -> bool: ... 86 | def framesPerSecond(self) -> int: ... 87 | def isAnimationEnabled(self) -> bool: ... 88 | def isValid(self) -> bool: ... 89 | @overload 90 | def load(self, contents: PySide6.QtCore.QXmlStreamReader) -> bool: ... 91 | @overload 92 | def load(self, contents: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> bool: ... 93 | @overload 94 | def load(self, filename: str) -> bool: ... 95 | def options(self) -> PySide6.QtSvg.QtSvg.Option: ... 96 | @overload 97 | def render(self, p: PySide6.QtGui.QPainter) -> None: ... 98 | @overload 99 | def render(self, p: PySide6.QtGui.QPainter, bounds: Union[PySide6.QtCore.QRectF, PySide6.QtCore.QRect]) -> None: ... 100 | @overload 101 | def render(self, p: PySide6.QtGui.QPainter, elementId: str, bounds: Union[PySide6.QtCore.QRectF, PySide6.QtCore.QRect] = ...) -> None: ... 102 | def setAnimationEnabled(self, enable: bool) -> None: ... 103 | def setAspectRatioMode(self, mode: PySide6.QtCore.Qt.AspectRatioMode) -> None: ... 104 | def setCurrentFrame(self, arg__1: int) -> None: ... 105 | def setFramesPerSecond(self, num: int) -> None: ... 106 | def setOptions(self, flags: PySide6.QtSvg.QtSvg.Option) -> None: ... 107 | @overload 108 | def setViewBox(self, viewbox: PySide6.QtCore.QRect) -> None: ... 109 | @overload 110 | def setViewBox(self, viewbox: Union[PySide6.QtCore.QRectF, PySide6.QtCore.QRect]) -> None: ... 111 | def transformForElement(self, id: str) -> PySide6.QtGui.QTransform: ... 112 | def viewBox(self) -> PySide6.QtCore.QRect: ... 113 | def viewBoxF(self) -> PySide6.QtCore.QRectF: ... 114 | 115 | 116 | class QtSvg(Shiboken.Object): 117 | 118 | class Option(enum.Flag): 119 | 120 | NoOption : QtSvg.Option = ... # 0x0 121 | Tiny12FeaturesOnly : QtSvg.Option = ... # 0x1 122 | 123 | 124 | # eof 125 | -------------------------------------------------------------------------------- /PySide6-stubs/QtSvgWidgets.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtSvgWidgets, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtSvgWidgets` 11 | 12 | import PySide6.QtSvgWidgets 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | import PySide6.QtSvg 17 | 18 | from typing import Optional, Union, overload 19 | from typing import TypeAlias, TypeVar 20 | 21 | 22 | NoneType: TypeAlias = type[None] 23 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 24 | 25 | 26 | class QGraphicsSvgItem(PySide6.QtWidgets.QGraphicsObject): 27 | 28 | @overload 29 | def __init__(self, fileName: str, parentItem: Optional[PySide6.QtWidgets.QGraphicsItem] = ...) -> None: ... 30 | @overload 31 | def __init__(self, parentItem: Optional[PySide6.QtWidgets.QGraphicsItem] = ...) -> None: ... 32 | 33 | def boundingRect(self) -> PySide6.QtCore.QRectF: ... 34 | def elementId(self) -> str: ... 35 | def isCachingEnabled(self) -> bool: ... 36 | def maximumCacheSize(self) -> PySide6.QtCore.QSize: ... 37 | def paint(self, painter: PySide6.QtGui.QPainter, option: PySide6.QtWidgets.QStyleOptionGraphicsItem, widget: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 38 | def renderer(self) -> PySide6.QtSvg.QSvgRenderer: ... 39 | def setCachingEnabled(self, arg__1: bool) -> None: ... 40 | def setElementId(self, id: str) -> None: ... 41 | def setMaximumCacheSize(self, size: PySide6.QtCore.QSize) -> None: ... 42 | def setSharedRenderer(self, renderer: PySide6.QtSvg.QSvgRenderer) -> None: ... 43 | def type(self) -> int: ... 44 | 45 | 46 | class QIntList(object): ... 47 | 48 | 49 | class QSvgWidget(PySide6.QtWidgets.QWidget): 50 | 51 | @overload 52 | def __init__(self, file: str, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 53 | @overload 54 | def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 55 | 56 | @overload 57 | def load(self, contents: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ... 58 | @overload 59 | def load(self, file: str) -> None: ... 60 | def options(self) -> PySide6.QtSvg.QtSvg.Option: ... 61 | def paintEvent(self, event: PySide6.QtGui.QPaintEvent) -> None: ... 62 | def renderer(self) -> PySide6.QtSvg.QSvgRenderer: ... 63 | def setOptions(self, options: PySide6.QtSvg.QtSvg.Option) -> None: ... 64 | def sizeHint(self) -> PySide6.QtCore.QSize: ... 65 | 66 | 67 | # eof 68 | -------------------------------------------------------------------------------- /PySide6-stubs/QtTextToSpeech.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtTextToSpeech, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtTextToSpeech` 11 | 12 | import PySide6.QtTextToSpeech 13 | import PySide6.QtCore 14 | 15 | import enum 16 | from typing import Any, ClassVar, Dict, List, Optional, Text, Union, overload 17 | from PySide6.QtCore import Signal 18 | from shiboken6 import Shiboken 19 | from typing import TypeAlias, TypeVar 20 | 21 | 22 | NoneType: TypeAlias = type[None] 23 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 24 | 25 | 26 | class QIntList(object): ... 27 | 28 | 29 | class QTextToSpeech(PySide6.QtCore.QObject): 30 | 31 | aboutToSynthesize : ClassVar[Signal] = ... # aboutToSynthesize(qsizetype) 32 | engineChanged : ClassVar[Signal] = ... # engineChanged(QString) 33 | errorOccurred : ClassVar[Signal] = ... # errorOccurred(QTextToSpeech::ErrorReason,QString) 34 | localeChanged : ClassVar[Signal] = ... # localeChanged(QLocale) 35 | pitchChanged : ClassVar[Signal] = ... # pitchChanged(double) 36 | rateChanged : ClassVar[Signal] = ... # rateChanged(double) 37 | sayingWord : ClassVar[Signal] = ... # sayingWord(QString,qsizetype,qsizetype,qsizetype) 38 | stateChanged : ClassVar[Signal] = ... # stateChanged(QTextToSpeech::State) 39 | voiceChanged : ClassVar[Signal] = ... # voiceChanged(QVoice) 40 | volumeChanged : ClassVar[Signal] = ... # volumeChanged(double) 41 | 42 | class BoundaryHint(enum.Enum): 43 | 44 | Default : QTextToSpeech.BoundaryHint = ... # 0x0 45 | Immediate : QTextToSpeech.BoundaryHint = ... # 0x1 46 | Word : QTextToSpeech.BoundaryHint = ... # 0x2 47 | Sentence : QTextToSpeech.BoundaryHint = ... # 0x3 48 | Utterance : QTextToSpeech.BoundaryHint = ... # 0x4 49 | 50 | class Capability(enum.Flag): 51 | 52 | None_ : QTextToSpeech.Capability = ... # 0x0 53 | Speak : QTextToSpeech.Capability = ... # 0x1 54 | PauseResume : QTextToSpeech.Capability = ... # 0x2 55 | WordByWordProgress : QTextToSpeech.Capability = ... # 0x4 56 | Synthesize : QTextToSpeech.Capability = ... # 0x8 57 | 58 | class ErrorReason(enum.Enum): 59 | 60 | NoError : QTextToSpeech.ErrorReason = ... # 0x0 61 | Initialization : QTextToSpeech.ErrorReason = ... # 0x1 62 | Configuration : QTextToSpeech.ErrorReason = ... # 0x2 63 | Input : QTextToSpeech.ErrorReason = ... # 0x3 64 | Playback : QTextToSpeech.ErrorReason = ... # 0x4 65 | 66 | class State(enum.Enum): 67 | 68 | Ready : QTextToSpeech.State = ... # 0x0 69 | Speaking : QTextToSpeech.State = ... # 0x1 70 | Paused : QTextToSpeech.State = ... # 0x2 71 | Error : QTextToSpeech.State = ... # 0x3 72 | Synthesizing : QTextToSpeech.State = ... # 0x4 73 | 74 | 75 | @overload 76 | def __init__(self, engine: str, params: Dict[str, Any], parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 77 | @overload 78 | def __init__(self, engine: str, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 79 | @overload 80 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 81 | 82 | def allVoices(self, locale: Union[PySide6.QtCore.QLocale, PySide6.QtCore.QLocale.Language]) -> List[PySide6.QtTextToSpeech.QVoice]: ... 83 | @staticmethod 84 | def availableEngines() -> List[str]: ... 85 | def availableLocales(self) -> List[PySide6.QtCore.QLocale]: ... 86 | def availableVoices(self) -> List[PySide6.QtTextToSpeech.QVoice]: ... 87 | def engine(self) -> str: ... 88 | def engineCapabilities(self) -> PySide6.QtTextToSpeech.QTextToSpeech.Capability: ... 89 | def enqueue(self, text: str) -> int: ... 90 | def errorReason(self) -> PySide6.QtTextToSpeech.QTextToSpeech.ErrorReason: ... 91 | def errorString(self) -> str: ... 92 | def locale(self) -> PySide6.QtCore.QLocale: ... 93 | def pause(self, boundaryHint: PySide6.QtTextToSpeech.QTextToSpeech.BoundaryHint = ...) -> None: ... 94 | def pitch(self) -> float: ... 95 | def rate(self) -> float: ... 96 | def resume(self) -> None: ... 97 | def say(self, text: str) -> None: ... 98 | def setEngine(self, engine: str, params: Dict[str, Any] = ...) -> bool: ... 99 | def setLocale(self, locale: Union[PySide6.QtCore.QLocale, PySide6.QtCore.QLocale.Language]) -> None: ... 100 | def setPitch(self, pitch: float) -> None: ... 101 | def setRate(self, rate: float) -> None: ... 102 | def setVoice(self, voice: PySide6.QtTextToSpeech.QVoice) -> None: ... 103 | def setVolume(self, volume: float) -> None: ... 104 | def state(self) -> PySide6.QtTextToSpeech.QTextToSpeech.State: ... 105 | def stop(self, boundaryHint: PySide6.QtTextToSpeech.QTextToSpeech.BoundaryHint = ...) -> None: ... 106 | def voice(self) -> PySide6.QtTextToSpeech.QVoice: ... 107 | def volume(self) -> float: ... 108 | 109 | 110 | class QTextToSpeechEngine(PySide6.QtCore.QObject): 111 | 112 | errorOccurred : ClassVar[Signal] = ... # errorOccurred(QTextToSpeech::ErrorReason,QString) 113 | sayingWord : ClassVar[Signal] = ... # sayingWord(QString,qsizetype,qsizetype) 114 | stateChanged : ClassVar[Signal] = ... # stateChanged(QTextToSpeech::State) 115 | synthesized : ClassVar[Signal] = ... # synthesized(QAudioFormat,QByteArray) 116 | 117 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 118 | 119 | def availableLocales(self) -> List[PySide6.QtCore.QLocale]: ... 120 | def availableVoices(self) -> List[PySide6.QtTextToSpeech.QVoice]: ... 121 | def capabilities(self) -> PySide6.QtTextToSpeech.QTextToSpeech.Capability: ... 122 | @staticmethod 123 | def createVoice(name: str, locale: Union[PySide6.QtCore.QLocale, PySide6.QtCore.QLocale.Language], gender: PySide6.QtTextToSpeech.QVoice.Gender, age: PySide6.QtTextToSpeech.QVoice.Age, data: Any) -> PySide6.QtTextToSpeech.QVoice: ... 124 | def errorReason(self) -> PySide6.QtTextToSpeech.QTextToSpeech.ErrorReason: ... 125 | def errorString(self) -> str: ... 126 | def locale(self) -> PySide6.QtCore.QLocale: ... 127 | def pause(self, boundaryHint: PySide6.QtTextToSpeech.QTextToSpeech.BoundaryHint) -> None: ... 128 | def pitch(self) -> float: ... 129 | def rate(self) -> float: ... 130 | def resume(self) -> None: ... 131 | def say(self, text: str) -> None: ... 132 | def setLocale(self, locale: Union[PySide6.QtCore.QLocale, PySide6.QtCore.QLocale.Language]) -> bool: ... 133 | def setPitch(self, pitch: float) -> bool: ... 134 | def setRate(self, rate: float) -> bool: ... 135 | def setVoice(self, voice: PySide6.QtTextToSpeech.QVoice) -> bool: ... 136 | def setVolume(self, volume: float) -> bool: ... 137 | def state(self) -> PySide6.QtTextToSpeech.QTextToSpeech.State: ... 138 | def stop(self, boundaryHint: PySide6.QtTextToSpeech.QTextToSpeech.BoundaryHint) -> None: ... 139 | def synthesize(self, text: str) -> None: ... 140 | def voice(self) -> PySide6.QtTextToSpeech.QVoice: ... 141 | @staticmethod 142 | def voiceData(voice: PySide6.QtTextToSpeech.QVoice) -> Any: ... 143 | def volume(self) -> float: ... 144 | 145 | 146 | class QVoice(Shiboken.Object): 147 | 148 | class Age(enum.Enum): 149 | 150 | Child : QVoice.Age = ... # 0x0 151 | Teenager : QVoice.Age = ... # 0x1 152 | Adult : QVoice.Age = ... # 0x2 153 | Senior : QVoice.Age = ... # 0x3 154 | Other : QVoice.Age = ... # 0x4 155 | 156 | class Gender(enum.Enum): 157 | 158 | Male : QVoice.Gender = ... # 0x0 159 | Female : QVoice.Gender = ... # 0x1 160 | Unknown : QVoice.Gender = ... # 0x2 161 | 162 | 163 | @overload 164 | def __init__(self) -> None: ... 165 | @overload 166 | def __init__(self, other: PySide6.QtTextToSpeech.QVoice) -> None: ... 167 | 168 | @staticmethod 169 | def __copy__() -> None: ... 170 | def __lshift__(self, str: PySide6.QtCore.QDataStream) -> PySide6.QtCore.QDataStream: ... 171 | def __rshift__(self, str: PySide6.QtCore.QDataStream) -> PySide6.QtCore.QDataStream: ... 172 | def age(self) -> PySide6.QtTextToSpeech.QVoice.Age: ... 173 | @staticmethod 174 | def ageName(age: PySide6.QtTextToSpeech.QVoice.Age) -> str: ... 175 | def gender(self) -> PySide6.QtTextToSpeech.QVoice.Gender: ... 176 | @staticmethod 177 | def genderName(gender: PySide6.QtTextToSpeech.QVoice.Gender) -> str: ... 178 | def language(self) -> PySide6.QtCore.QLocale.Language: ... 179 | def locale(self) -> PySide6.QtCore.QLocale: ... 180 | def name(self) -> str: ... 181 | def swap(self, other: PySide6.QtTextToSpeech.QVoice) -> None: ... 182 | 183 | 184 | # eof 185 | -------------------------------------------------------------------------------- /PySide6-stubs/QtUiTools.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtUiTools, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtUiTools` 11 | 12 | import PySide6.QtUiTools 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | 17 | import os 18 | from typing import List, Optional, Union, overload 19 | from typing import TypeAlias, TypeVar 20 | 21 | 22 | NoneType: TypeAlias = type[None] 23 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 24 | 25 | 26 | class QIntList(object): ... 27 | 28 | 29 | class QUiLoader(PySide6.QtCore.QObject): 30 | 31 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 32 | 33 | def addPluginPath(self, path: str) -> None: ... 34 | def availableLayouts(self) -> List[str]: ... 35 | def availableWidgets(self) -> List[str]: ... 36 | def clearPluginPaths(self) -> None: ... 37 | def createAction(self, parent: Optional[PySide6.QtCore.QObject] = ..., name: str = ...) -> PySide6.QtGui.QAction: ... 38 | def createActionGroup(self, parent: Optional[PySide6.QtCore.QObject] = ..., name: str = ...) -> PySide6.QtGui.QActionGroup: ... 39 | def createLayout(self, className: str, parent: Optional[PySide6.QtCore.QObject] = ..., name: str = ...) -> PySide6.QtWidgets.QLayout: ... 40 | def createWidget(self, className: str, parent: Optional[PySide6.QtWidgets.QWidget] = ..., name: str = ...) -> PySide6.QtWidgets.QWidget: ... 41 | def errorString(self) -> str: ... 42 | def isLanguageChangeEnabled(self) -> bool: ... 43 | def isTranslationEnabled(self) -> bool: ... 44 | @overload 45 | def load(self, arg__1: Union[str, bytes, os.PathLike[str]], parentWidget: Optional[PySide6.QtWidgets.QWidget] = ...) -> PySide6.QtWidgets.QWidget: ... 46 | @overload 47 | def load(self, device: PySide6.QtCore.QIODevice, parentWidget: Optional[PySide6.QtWidgets.QWidget] = ...) -> PySide6.QtWidgets.QWidget: ... 48 | def pluginPaths(self) -> List[str]: ... 49 | def registerCustomWidget(self, customWidgetType: object) -> None: ... 50 | def setLanguageChangeEnabled(self, enabled: bool) -> None: ... 51 | def setTranslationEnabled(self, enabled: bool) -> None: ... 52 | def setWorkingDirectory(self, dir: PySide6.QtCore.QDir) -> None: ... 53 | def workingDirectory(self) -> PySide6.QtCore.QDir: ... 54 | 55 | 56 | def loadUiType(uifile: str) -> object: ... 57 | 58 | 59 | # eof 60 | -------------------------------------------------------------------------------- /PySide6-stubs/QtWebChannel.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtWebChannel, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtWebChannel` 11 | 12 | import PySide6.QtWebChannel 13 | import PySide6.QtCore 14 | 15 | from typing import ClassVar, Dict, Optional 16 | from PySide6.QtCore import Signal 17 | from typing import TypeAlias, TypeVar 18 | 19 | 20 | NoneType: TypeAlias = type[None] 21 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 22 | 23 | 24 | class QIntList(object): ... 25 | 26 | 27 | class QWebChannel(PySide6.QtCore.QObject): 28 | 29 | blockUpdatesChanged : ClassVar[Signal] = ... # blockUpdatesChanged(bool) 30 | 31 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 32 | 33 | def blockUpdates(self) -> bool: ... 34 | def connectTo(self, transport: PySide6.QtWebChannel.QWebChannelAbstractTransport) -> None: ... 35 | def deregisterObject(self, object: PySide6.QtCore.QObject) -> None: ... 36 | def disconnectFrom(self, transport: PySide6.QtWebChannel.QWebChannelAbstractTransport) -> None: ... 37 | def propertyUpdateInterval(self) -> int: ... 38 | def registerObject(self, id: str, object: PySide6.QtCore.QObject) -> None: ... 39 | def registerObjects(self, objects: Dict[str, PySide6.QtCore.QObject]) -> None: ... 40 | def registeredObjects(self) -> Dict[str, PySide6.QtCore.QObject]: ... 41 | def setBlockUpdates(self, block: bool) -> None: ... 42 | def setPropertyUpdateInterval(self, ms: int) -> None: ... 43 | 44 | 45 | class QWebChannelAbstractTransport(PySide6.QtCore.QObject): 46 | 47 | messageReceived : ClassVar[Signal] = ... # messageReceived(QJsonObject,QWebChannelAbstractTransport*) 48 | 49 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 50 | 51 | def sendMessage(self, message: Dict[str, PySide6.QtCore.QJsonValue]) -> None: ... 52 | 53 | 54 | # eof 55 | -------------------------------------------------------------------------------- /PySide6-stubs/QtWebEngineQuick.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtWebEngineQuick, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtWebEngineQuick` 11 | 12 | import PySide6.QtWebEngineQuick 13 | import PySide6.QtCore 14 | import PySide6.QtWebEngineCore 15 | 16 | import enum 17 | from typing import ClassVar, List, Optional, Sequence, Type, Union 18 | from PySide6.QtCore import Signal 19 | from shiboken6 import Shiboken 20 | from typing import TypeAlias, TypeVar 21 | 22 | 23 | NoneType: TypeAlias = type[None] 24 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 25 | 26 | 27 | class QIntList(object): ... 28 | 29 | 30 | class QQuickWebEngineProfile(PySide6.QtCore.QObject): 31 | 32 | cachePathChanged : ClassVar[Signal] = ... # cachePathChanged() 33 | clearHttpCacheCompleted : ClassVar[Signal] = ... # clearHttpCacheCompleted() 34 | downloadFinished : ClassVar[Signal] = ... # downloadFinished(QQuickWebEngineDownloadRequest*) 35 | downloadPathChanged : ClassVar[Signal] = ... # downloadPathChanged() 36 | downloadRequested : ClassVar[Signal] = ... # downloadRequested(QQuickWebEngineDownloadRequest*) 37 | httpAcceptLanguageChanged: ClassVar[Signal] = ... # httpAcceptLanguageChanged() 38 | httpCacheMaximumSizeChanged: ClassVar[Signal] = ... # httpCacheMaximumSizeChanged() 39 | httpCacheTypeChanged : ClassVar[Signal] = ... # httpCacheTypeChanged() 40 | httpUserAgentChanged : ClassVar[Signal] = ... # httpUserAgentChanged() 41 | offTheRecordChanged : ClassVar[Signal] = ... # offTheRecordChanged() 42 | persistentCookiesPolicyChanged: ClassVar[Signal] = ... # persistentCookiesPolicyChanged() 43 | persistentStoragePathChanged: ClassVar[Signal] = ... # persistentStoragePathChanged() 44 | presentNotification : ClassVar[Signal] = ... # presentNotification(QWebEngineNotification*) 45 | pushServiceEnabledChanged: ClassVar[Signal] = ... # pushServiceEnabledChanged() 46 | spellCheckEnabledChanged : ClassVar[Signal] = ... # spellCheckEnabledChanged() 47 | spellCheckLanguagesChanged: ClassVar[Signal] = ... # spellCheckLanguagesChanged() 48 | storageNameChanged : ClassVar[Signal] = ... # storageNameChanged() 49 | 50 | class HttpCacheType(enum.Enum): 51 | 52 | MemoryHttpCache : QQuickWebEngineProfile.HttpCacheType = ... # 0x0 53 | DiskHttpCache : QQuickWebEngineProfile.HttpCacheType = ... # 0x1 54 | NoCache : QQuickWebEngineProfile.HttpCacheType = ... # 0x2 55 | 56 | class PersistentCookiesPolicy(enum.Enum): 57 | 58 | NoPersistentCookies : QQuickWebEngineProfile.PersistentCookiesPolicy = ... # 0x0 59 | AllowPersistentCookies : QQuickWebEngineProfile.PersistentCookiesPolicy = ... # 0x1 60 | ForcePersistentCookies : QQuickWebEngineProfile.PersistentCookiesPolicy = ... # 0x2 61 | 62 | 63 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 64 | 65 | def cachePath(self) -> str: ... 66 | def clearHttpCache(self) -> None: ... 67 | def clientCertificateStore(self) -> PySide6.QtWebEngineCore.QWebEngineClientCertificateStore: ... 68 | def cookieStore(self) -> PySide6.QtWebEngineCore.QWebEngineCookieStore: ... 69 | @staticmethod 70 | def defaultProfile() -> PySide6.QtWebEngineQuick.QQuickWebEngineProfile: ... 71 | def downloadPath(self) -> str: ... 72 | def httpAcceptLanguage(self) -> str: ... 73 | def httpCacheMaximumSize(self) -> int: ... 74 | def httpCacheType(self) -> PySide6.QtWebEngineQuick.QQuickWebEngineProfile.HttpCacheType: ... 75 | def httpUserAgent(self) -> str: ... 76 | def installUrlSchemeHandler(self, scheme: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], arg__2: PySide6.QtWebEngineCore.QWebEngineUrlSchemeHandler) -> None: ... 77 | def isOffTheRecord(self) -> bool: ... 78 | def isPushServiceEnabled(self) -> bool: ... 79 | def isSpellCheckEnabled(self) -> bool: ... 80 | def persistentCookiesPolicy(self) -> PySide6.QtWebEngineQuick.QQuickWebEngineProfile.PersistentCookiesPolicy: ... 81 | def persistentStoragePath(self) -> str: ... 82 | def removeAllUrlSchemeHandlers(self) -> None: ... 83 | def removeUrlScheme(self, scheme: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> None: ... 84 | def removeUrlSchemeHandler(self, arg__1: PySide6.QtWebEngineCore.QWebEngineUrlSchemeHandler) -> None: ... 85 | def setCachePath(self, path: str) -> None: ... 86 | def setDownloadPath(self, path: str) -> None: ... 87 | def setHttpAcceptLanguage(self, httpAcceptLanguage: str) -> None: ... 88 | def setHttpCacheMaximumSize(self, maxSize: int) -> None: ... 89 | def setHttpCacheType(self, arg__1: PySide6.QtWebEngineQuick.QQuickWebEngineProfile.HttpCacheType) -> None: ... 90 | def setHttpUserAgent(self, userAgent: str) -> None: ... 91 | def setOffTheRecord(self, offTheRecord: bool) -> None: ... 92 | def setPersistentCookiesPolicy(self, arg__1: PySide6.QtWebEngineQuick.QQuickWebEngineProfile.PersistentCookiesPolicy) -> None: ... 93 | def setPersistentStoragePath(self, path: str) -> None: ... 94 | def setPushServiceEnabled(self, enable: bool) -> None: ... 95 | def setSpellCheckEnabled(self, enabled: bool) -> None: ... 96 | def setSpellCheckLanguages(self, languages: Sequence[str]) -> None: ... 97 | def setStorageName(self, name: str) -> None: ... 98 | def setUrlRequestInterceptor(self, interceptor: PySide6.QtWebEngineCore.QWebEngineUrlRequestInterceptor) -> None: ... 99 | def spellCheckLanguages(self) -> List[str]: ... 100 | def storageName(self) -> str: ... 101 | def urlSchemeHandler(self, arg__1: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> PySide6.QtWebEngineCore.QWebEngineUrlSchemeHandler: ... 102 | 103 | 104 | class QtWebEngineQuick(Shiboken.Object): 105 | @staticmethod 106 | def initialize() -> None: ... 107 | 108 | 109 | # eof 110 | -------------------------------------------------------------------------------- /PySide6-stubs/QtWebEngineWidgets.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtWebEngineWidgets, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtWebEngineWidgets` 11 | 12 | import PySide6.QtWebEngineWidgets 13 | import PySide6.QtCore 14 | import PySide6.QtGui 15 | import PySide6.QtWidgets 16 | import PySide6.QtPrintSupport 17 | import PySide6.QtWebEngineCore 18 | 19 | from typing import ClassVar, Optional, Set, Union, overload 20 | from PySide6.QtCore import Signal 21 | from typing import TypeAlias, TypeVar 22 | 23 | 24 | NoneType: TypeAlias = type[None] 25 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 26 | 27 | 28 | class QIntList(object): ... 29 | 30 | 31 | class QWebEngineView(PySide6.QtWidgets.QWidget): 32 | 33 | iconChanged : ClassVar[Signal] = ... # iconChanged(QIcon) 34 | iconUrlChanged : ClassVar[Signal] = ... # iconUrlChanged(QUrl) 35 | loadFinished : ClassVar[Signal] = ... # loadFinished(bool) 36 | loadProgress : ClassVar[Signal] = ... # loadProgress(int) 37 | loadStarted : ClassVar[Signal] = ... # loadStarted() 38 | pdfPrintingFinished : ClassVar[Signal] = ... # pdfPrintingFinished(QString,bool) 39 | printFinished : ClassVar[Signal] = ... # printFinished(bool) 40 | printRequested : ClassVar[Signal] = ... # printRequested() 41 | renderProcessTerminated : ClassVar[Signal] = ... # renderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus,int) 42 | selectionChanged : ClassVar[Signal] = ... # selectionChanged() 43 | titleChanged : ClassVar[Signal] = ... # titleChanged(QString) 44 | urlChanged : ClassVar[Signal] = ... # urlChanged(QUrl) 45 | 46 | @overload 47 | def __init__(self, page: PySide6.QtWebEngineCore.QWebEnginePage, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 48 | @overload 49 | def __init__(self, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 50 | @overload 51 | def __init__(self, profile: PySide6.QtWebEngineCore.QWebEngineProfile, parent: Optional[PySide6.QtWidgets.QWidget] = ...) -> None: ... 52 | 53 | def back(self) -> None: ... 54 | def closeEvent(self, arg__1: PySide6.QtGui.QCloseEvent) -> None: ... 55 | def contextMenuEvent(self, arg__1: PySide6.QtGui.QContextMenuEvent) -> None: ... 56 | def createStandardContextMenu(self) -> PySide6.QtWidgets.QMenu: ... 57 | def createWindow(self, type: PySide6.QtWebEngineCore.QWebEnginePage.WebWindowType) -> PySide6.QtWebEngineWidgets.QWebEngineView: ... 58 | def dragEnterEvent(self, e: PySide6.QtGui.QDragEnterEvent) -> None: ... 59 | def dragLeaveEvent(self, e: PySide6.QtGui.QDragLeaveEvent) -> None: ... 60 | def dragMoveEvent(self, e: PySide6.QtGui.QDragMoveEvent) -> None: ... 61 | def dropEvent(self, e: PySide6.QtGui.QDropEvent) -> None: ... 62 | def event(self, arg__1: PySide6.QtCore.QEvent) -> bool: ... 63 | @overload 64 | def findText(self, arg__1: str, arg__2: PySide6.QtWebEngineCore.QWebEnginePage.FindFlag, arg__3: object) -> None: ... 65 | @overload 66 | def findText(self, subString: str, options: PySide6.QtWebEngineCore.QWebEnginePage.FindFlag = ...) -> None: ... 67 | @staticmethod 68 | def forPage(page: PySide6.QtWebEngineCore.QWebEnginePage) -> PySide6.QtWebEngineWidgets.QWebEngineView: ... 69 | def forward(self) -> None: ... 70 | def hasSelection(self) -> bool: ... 71 | def hideEvent(self, arg__1: PySide6.QtGui.QHideEvent) -> None: ... 72 | def history(self) -> PySide6.QtWebEngineCore.QWebEngineHistory: ... 73 | def icon(self) -> PySide6.QtGui.QIcon: ... 74 | def iconUrl(self) -> PySide6.QtCore.QUrl: ... 75 | def lastContextMenuRequest(self) -> PySide6.QtWebEngineCore.QWebEngineContextMenuRequest: ... 76 | @overload 77 | def load(self, request: PySide6.QtWebEngineCore.QWebEngineHttpRequest) -> None: ... 78 | @overload 79 | def load(self, url: Union[PySide6.QtCore.QUrl, str]) -> None: ... 80 | def page(self) -> PySide6.QtWebEngineCore.QWebEnginePage: ... 81 | def pageAction(self, action: PySide6.QtWebEngineCore.QWebEnginePage.WebAction) -> PySide6.QtGui.QAction: ... 82 | def print(self, printer: PySide6.QtPrintSupport.QPrinter) -> None: ... 83 | def printToPdf(self, filePath: str, layout: PySide6.QtGui.QPageLayout = ..., ranges: PySide6.QtGui.QPageRanges = ...) -> None: ... 84 | def reload(self) -> None: ... 85 | def selectedText(self) -> str: ... 86 | def setContent(self, data: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview], mimeType: str = ..., baseUrl: Union[PySide6.QtCore.QUrl, str] = ...) -> None: ... 87 | def setHtml(self, html: str, baseUrl: Union[PySide6.QtCore.QUrl, str] = ...) -> None: ... 88 | def setPage(self, page: PySide6.QtWebEngineCore.QWebEnginePage) -> None: ... 89 | def setUrl(self, url: Union[PySide6.QtCore.QUrl, str]) -> None: ... 90 | def setZoomFactor(self, factor: float) -> None: ... 91 | def settings(self) -> PySide6.QtWebEngineCore.QWebEngineSettings: ... 92 | def showEvent(self, arg__1: PySide6.QtGui.QShowEvent) -> None: ... 93 | def sizeHint(self) -> PySide6.QtCore.QSize: ... 94 | def stop(self) -> None: ... 95 | def title(self) -> str: ... 96 | def triggerPageAction(self, action: PySide6.QtWebEngineCore.QWebEnginePage.WebAction, checked: bool = ...) -> None: ... 97 | def url(self) -> PySide6.QtCore.QUrl: ... 98 | def zoomFactor(self) -> float: ... 99 | 100 | 101 | # eof 102 | -------------------------------------------------------------------------------- /PySide6-stubs/QtWebSockets.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | from __future__ import annotations 4 | 5 | """ 6 | This file contains the exact signatures for all functions in module 7 | PySide6.QtWebSockets, except for defaults which are replaced by "...". 8 | """ 9 | 10 | # Module `PySide6.QtWebSockets` 11 | 12 | import PySide6.QtWebSockets 13 | import PySide6.QtCore 14 | import PySide6.QtNetwork 15 | 16 | import os 17 | import enum 18 | from typing import ClassVar, Generator, List, Optional, Protocol, Sequence, Union, overload 19 | from PySide6.QtCore import Signal 20 | from shiboken6 import Shiboken 21 | from typing import TypeAlias, TypeVar 22 | 23 | 24 | NoneType: TypeAlias = type[None] 25 | PlaceHolderType = TypeVar("PlaceHolderType", bound=QObject) 26 | 27 | 28 | class QIntList(object): ... 29 | 30 | 31 | class QMaskGenerator(PySide6.QtCore.QObject): 32 | 33 | destroyed: PySide6.QtCore.Signal 34 | objectNameChanged: PySide6.QtCore.Signal 35 | 36 | 37 | def __init__(self, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 38 | 39 | def nextMask(self) -> int: ... 40 | def seed(self) -> bool: ... 41 | 42 | 43 | class QWebSocket(PySide6.QtCore.QObject): 44 | 45 | aboutToClose : ClassVar[Signal] = ... # aboutToClose() 46 | alertReceived : ClassVar[Signal] = ... # alertReceived(QSsl::AlertLevel,QSsl::AlertType,QString) 47 | alertSent : ClassVar[Signal] = ... # alertSent(QSsl::AlertLevel,QSsl::AlertType,QString) 48 | authenticationRequired : ClassVar[Signal] = ... # authenticationRequired(QAuthenticator*) 49 | binaryFrameReceived : ClassVar[Signal] = ... # binaryFrameReceived(QByteArray,bool) 50 | binaryMessageReceived : ClassVar[Signal] = ... # binaryMessageReceived(QByteArray) 51 | bytesWritten : ClassVar[Signal] = ... # bytesWritten(qlonglong) 52 | connected : ClassVar[Signal] = ... # connected() 53 | disconnected : ClassVar[Signal] = ... # disconnected() 54 | error : ClassVar[Signal] = ... # error(QAbstractSocket::SocketError) 55 | errorOccurred : ClassVar[Signal] = ... # errorOccurred(QAbstractSocket::SocketError) 56 | handshakeInterruptedOnError: ClassVar[Signal] = ... # handshakeInterruptedOnError(QSslError) 57 | peerVerifyError : ClassVar[Signal] = ... # peerVerifyError(QSslError) 58 | pong : ClassVar[Signal] = ... # pong(qulonglong,QByteArray) 59 | preSharedKeyAuthenticationRequired: ClassVar[Signal] = ... # preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*) 60 | proxyAuthenticationRequired: ClassVar[Signal] = ... # proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*) 61 | readChannelFinished : ClassVar[Signal] = ... # readChannelFinished() 62 | sslErrors : ClassVar[Signal] = ... # sslErrors(QList) 63 | stateChanged : ClassVar[Signal] = ... # stateChanged(QAbstractSocket::SocketState) 64 | textFrameReceived : ClassVar[Signal] = ... # textFrameReceived(QString,bool) 65 | textMessageReceived : ClassVar[Signal] = ... # textMessageReceived(QString) 66 | 67 | def __init__(self, origin: str = ..., version: PySide6.QtWebSockets.QWebSocketProtocol.Version = ..., parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 68 | 69 | def abort(self) -> None: ... 70 | def bytesToWrite(self) -> int: ... 71 | def close(self, closeCode: PySide6.QtWebSockets.QWebSocketProtocol.CloseCode = ..., reason: str = ...) -> None: ... 72 | def closeCode(self) -> PySide6.QtWebSockets.QWebSocketProtocol.CloseCode: ... 73 | def closeReason(self) -> str: ... 74 | def continueInterruptedHandshake(self) -> None: ... 75 | def errorString(self) -> str: ... 76 | def flush(self) -> bool: ... 77 | def handshakeOptions(self) -> PySide6.QtWebSockets.QWebSocketHandshakeOptions: ... 78 | @overload 79 | def ignoreSslErrors(self) -> None: ... 80 | @overload 81 | def ignoreSslErrors(self, errors: Sequence[PySide6.QtNetwork.QSslError]) -> None: ... 82 | def isValid(self) -> bool: ... 83 | def localAddress(self) -> PySide6.QtNetwork.QHostAddress: ... 84 | def localPort(self) -> int: ... 85 | def maskGenerator(self) -> PySide6.QtWebSockets.QMaskGenerator: ... 86 | def maxAllowedIncomingFrameSize(self) -> int: ... 87 | def maxAllowedIncomingMessageSize(self) -> int: ... 88 | @staticmethod 89 | def maxIncomingFrameSize() -> int: ... 90 | @staticmethod 91 | def maxIncomingMessageSize() -> int: ... 92 | @staticmethod 93 | def maxOutgoingFrameSize() -> int: ... 94 | @overload 95 | def open(self, request: PySide6.QtNetwork.QNetworkRequest) -> None: ... 96 | @overload 97 | def open(self, request: PySide6.QtNetwork.QNetworkRequest, options: PySide6.QtWebSockets.QWebSocketHandshakeOptions) -> None: ... 98 | @overload 99 | def open(self, url: Union[PySide6.QtCore.QUrl, str]) -> None: ... 100 | @overload 101 | def open(self, url: Union[PySide6.QtCore.QUrl, str], options: PySide6.QtWebSockets.QWebSocketHandshakeOptions) -> None: ... 102 | def origin(self) -> str: ... 103 | def outgoingFrameSize(self) -> int: ... 104 | def pauseMode(self) -> PySide6.QtNetwork.QAbstractSocket.PauseMode: ... 105 | def peerAddress(self) -> PySide6.QtNetwork.QHostAddress: ... 106 | def peerName(self) -> str: ... 107 | def peerPort(self) -> int: ... 108 | def ping(self, payload: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview] = ...) -> None: ... 109 | def proxy(self) -> PySide6.QtNetwork.QNetworkProxy: ... 110 | def readBufferSize(self) -> int: ... 111 | def request(self) -> PySide6.QtNetwork.QNetworkRequest: ... 112 | def requestUrl(self) -> PySide6.QtCore.QUrl: ... 113 | def resourceName(self) -> str: ... 114 | def resume(self) -> None: ... 115 | def sendBinaryMessage(self, data: Union[PySide6.QtCore.QByteArray, bytes, bytearray, memoryview]) -> int: ... 116 | def sendTextMessage(self, message: str) -> int: ... 117 | def setMaskGenerator(self, maskGenerator: PySide6.QtWebSockets.QMaskGenerator) -> None: ... 118 | def setMaxAllowedIncomingFrameSize(self, maxAllowedIncomingFrameSize: int) -> None: ... 119 | def setMaxAllowedIncomingMessageSize(self, maxAllowedIncomingMessageSize: int) -> None: ... 120 | def setOutgoingFrameSize(self, outgoingFrameSize: int) -> None: ... 121 | def setPauseMode(self, pauseMode: PySide6.QtNetwork.QAbstractSocket.PauseMode) -> None: ... 122 | def setProxy(self, networkProxy: Union[PySide6.QtNetwork.QNetworkProxy, PySide6.QtNetwork.QNetworkProxy.ProxyType]) -> None: ... 123 | def setReadBufferSize(self, size: int) -> None: ... 124 | def setSslConfiguration(self, sslConfiguration: PySide6.QtNetwork.QSslConfiguration) -> None: ... 125 | def sslConfiguration(self) -> PySide6.QtNetwork.QSslConfiguration: ... 126 | def state(self) -> PySide6.QtNetwork.QAbstractSocket.SocketState: ... 127 | def subprotocol(self) -> str: ... 128 | def version(self) -> PySide6.QtWebSockets.QWebSocketProtocol.Version: ... 129 | 130 | 131 | class QWebSocketCorsAuthenticator(Shiboken.Object): 132 | 133 | @overload 134 | def __init__(self, origin: str) -> None: ... 135 | @overload 136 | def __init__(self, other: PySide6.QtWebSockets.QWebSocketCorsAuthenticator) -> None: ... 137 | 138 | def allowed(self) -> bool: ... 139 | def origin(self) -> str: ... 140 | def setAllowed(self, allowed: bool) -> None: ... 141 | def swap(self, other: PySide6.QtWebSockets.QWebSocketCorsAuthenticator) -> None: ... 142 | 143 | 144 | class QWebSocketHandshakeOptions(Shiboken.Object): 145 | 146 | @overload 147 | def __init__(self) -> None: ... 148 | @overload 149 | def __init__(self, other: PySide6.QtWebSockets.QWebSocketHandshakeOptions) -> None: ... 150 | 151 | @staticmethod 152 | def __copy__() -> None: ... 153 | def setSubprotocols(self, protocols: Sequence[str]) -> None: ... 154 | def subprotocols(self) -> List[str]: ... 155 | def swap(self, other: PySide6.QtWebSockets.QWebSocketHandshakeOptions) -> None: ... 156 | 157 | 158 | class QWebSocketProtocol(Shiboken.Object): 159 | 160 | class CloseCode(enum.Enum): 161 | 162 | CloseCodeNormal : QWebSocketProtocol.CloseCode = ... # 0x3e8 163 | CloseCodeGoingAway : QWebSocketProtocol.CloseCode = ... # 0x3e9 164 | CloseCodeProtocolError : QWebSocketProtocol.CloseCode = ... # 0x3ea 165 | CloseCodeDatatypeNotSupported: QWebSocketProtocol.CloseCode = ... # 0x3eb 166 | CloseCodeReserved1004 : QWebSocketProtocol.CloseCode = ... # 0x3ec 167 | CloseCodeMissingStatusCode: QWebSocketProtocol.CloseCode = ... # 0x3ed 168 | CloseCodeAbnormalDisconnection: QWebSocketProtocol.CloseCode = ... # 0x3ee 169 | CloseCodeWrongDatatype : QWebSocketProtocol.CloseCode = ... # 0x3ef 170 | CloseCodePolicyViolated : QWebSocketProtocol.CloseCode = ... # 0x3f0 171 | CloseCodeTooMuchData : QWebSocketProtocol.CloseCode = ... # 0x3f1 172 | CloseCodeMissingExtension: QWebSocketProtocol.CloseCode = ... # 0x3f2 173 | CloseCodeBadOperation : QWebSocketProtocol.CloseCode = ... # 0x3f3 174 | CloseCodeTlsHandshakeFailed: QWebSocketProtocol.CloseCode = ... # 0x3f7 175 | 176 | class Version(enum.Enum): 177 | 178 | VersionUnknown : QWebSocketProtocol.Version = ... # -0x1 179 | Version0 : QWebSocketProtocol.Version = ... # 0x0 180 | Version4 : QWebSocketProtocol.Version = ... # 0x4 181 | Version5 : QWebSocketProtocol.Version = ... # 0x5 182 | Version6 : QWebSocketProtocol.Version = ... # 0x6 183 | Version7 : QWebSocketProtocol.Version = ... # 0x7 184 | Version8 : QWebSocketProtocol.Version = ... # 0x8 185 | Version13 : QWebSocketProtocol.Version = ... # 0xd 186 | VersionLatest : QWebSocketProtocol.Version = ... # 0xd 187 | 188 | 189 | class QWebSocketServer(PySide6.QtCore.QObject): 190 | 191 | acceptError : ClassVar[Signal] = ... # acceptError(QAbstractSocket::SocketError) 192 | alertReceived : ClassVar[Signal] = ... # alertReceived(QSsl::AlertLevel,QSsl::AlertType,QString) 193 | alertSent : ClassVar[Signal] = ... # alertSent(QSsl::AlertLevel,QSsl::AlertType,QString) 194 | closed : ClassVar[Signal] = ... # closed() 195 | handshakeInterruptedOnError: ClassVar[Signal] = ... # handshakeInterruptedOnError(QSslError) 196 | newConnection : ClassVar[Signal] = ... # newConnection() 197 | originAuthenticationRequired: ClassVar[Signal] = ... # originAuthenticationRequired(QWebSocketCorsAuthenticator*) 198 | peerVerifyError : ClassVar[Signal] = ... # peerVerifyError(QSslError) 199 | preSharedKeyAuthenticationRequired: ClassVar[Signal] = ... # preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*) 200 | serverError : ClassVar[Signal] = ... # serverError(QWebSocketProtocol::CloseCode) 201 | sslErrors : ClassVar[Signal] = ... # sslErrors(QList) 202 | 203 | class SslMode(enum.Enum): 204 | 205 | SecureMode : QWebSocketServer.SslMode = ... # 0x0 206 | NonSecureMode : QWebSocketServer.SslMode = ... # 0x1 207 | 208 | 209 | def __init__(self, serverName: str, secureMode: PySide6.QtWebSockets.QWebSocketServer.SslMode, parent: Optional[PySide6.QtCore.QObject] = ...) -> None: ... 210 | 211 | def close(self) -> None: ... 212 | def error(self) -> PySide6.QtWebSockets.QWebSocketProtocol.CloseCode: ... 213 | def errorString(self) -> str: ... 214 | def handleConnection(self, socket: PySide6.QtNetwork.QTcpSocket) -> None: ... 215 | def handshakeTimeoutMS(self) -> int: ... 216 | def hasPendingConnections(self) -> bool: ... 217 | def isListening(self) -> bool: ... 218 | def listen(self, address: Union[PySide6.QtNetwork.QHostAddress, PySide6.QtNetwork.QHostAddress.SpecialAddress] = ..., port: int = ...) -> bool: ... 219 | def maxPendingConnections(self) -> int: ... 220 | def nativeDescriptor(self) -> int: ... 221 | def nextPendingConnection(self) -> PySide6.QtWebSockets.QWebSocket: ... 222 | def pauseAccepting(self) -> None: ... 223 | def proxy(self) -> PySide6.QtNetwork.QNetworkProxy: ... 224 | def resumeAccepting(self) -> None: ... 225 | def secureMode(self) -> PySide6.QtWebSockets.QWebSocketServer.SslMode: ... 226 | def serverAddress(self) -> PySide6.QtNetwork.QHostAddress: ... 227 | def serverName(self) -> str: ... 228 | def serverPort(self) -> int: ... 229 | def serverUrl(self) -> PySide6.QtCore.QUrl: ... 230 | def setHandshakeTimeout(self, msec: int) -> None: ... 231 | def setMaxPendingConnections(self, numConnections: int) -> None: ... 232 | def setNativeDescriptor(self, descriptor: int) -> bool: ... 233 | def setProxy(self, networkProxy: Union[PySide6.QtNetwork.QNetworkProxy, PySide6.QtNetwork.QNetworkProxy.ProxyType]) -> None: ... 234 | def setServerName(self, serverName: str) -> None: ... 235 | def setSocketDescriptor(self, socketDescriptor: int) -> bool: ... 236 | def setSslConfiguration(self, sslConfiguration: PySide6.QtNetwork.QSslConfiguration) -> None: ... 237 | def setSupportedSubprotocols(self, protocols: Sequence[str]) -> None: ... 238 | def socketDescriptor(self) -> int: ... 239 | def sslConfiguration(self) -> PySide6.QtNetwork.QSslConfiguration: ... 240 | def supportedSubprotocols(self) -> List[str]: ... 241 | def supportedVersions(self) -> List[PySide6.QtWebSockets.QWebSocketProtocol.Version]: ... 242 | 243 | 244 | # eof 245 | -------------------------------------------------------------------------------- /PySide6-stubs/__feature__.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | snake_case = 0x01 5 | true_property = 0x02 6 | 7 | all_feature_names = [ 8 | "snake_case", 9 | "true_property", 10 | ] 11 | -------------------------------------------------------------------------------- /PySide6-stubs/__init__.pyi: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Object: ... -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | mypy logo [![Continuous Integration](https://github.com/python-qt-tools/PySide6-stubs/actions/workflows/ci.yml/badge.svg)](https://github.com/python-qt-tools/PySide6-stubs/actions/workflows/ci.yml) 2 | 3 | 4 | # Mypy stubs for the PySide6 (Qt6 for Python) 5 | 6 | *Author :* Philippe Fremy 7 | 8 | This package provides improved typing stubs for [Qt6 for Python/PySide6](https://pypi.org/project/PySide6/). The 9 | official stubs delivered along with PySide6 are reasonably good but may be incomplete in a few areas 10 | for proper typing verification with `mypy`. 11 | 12 | ### Notable improvements: 13 | * add typing information for all properties 14 | * add conversion from `QByteArray` to `bytes` 15 | * add construction of `QByteArray` from length and string 16 | * fix `QFileDialog.getOpen*()` methods to accept `None` as parent argument 17 | * fix `QLineEdit.setText()` to accept `None` 18 | * fix `QTreeWidget.setItemWidget()` and `QListWidget.setItemWidget()` to accept `None` as a widget argument 19 | * fix `QProgressDialog.setCancelButton()` accepting `None` 20 | * support all `QSize` and `QSizeF` operations 21 | * fix `QTabBar.setButtonWidget()` to accept `None` as a widget argument 22 | * fix `QTreeWidget.topLevelItem()` returning possibly `None` 23 | * fix `QTreeWidgetItem` comparison with `<` 24 | * fix `QMessageBox.warning`, `information`, `critical`, `question`, `about`, `aboutQt` to accept `None` as parent argument 25 | * fix `qVersion()` returns string, not bytes 26 | * fix `qDebug()`, `qWarning()`, `qCritical()`, `qFatal()`, `SIGNAL()`, `SLOT()` to accept string, not bytes 27 | * fix `Signal.connect()`, `Signal.disconnect()`, `QObject.connect()` and `QObject.disconnect()` to accept `str` instead 28 | of `bool`, and to return `bool` on disconnect. 29 | * fix incorrect signature of `QCoreApplication.translate()` 30 | * improve signature of operations on `QPolygon` 31 | * fix `QObject.findChildren()` and `QObject.findChild()` to detect that type being returned is the one being searched 32 | 33 | 34 | See [CHANGELOG.md](CHANGELOG.md) for full details. 35 | 36 | This effort was inspired by the PyQt5-stubs and PySide2-stubs project. 37 | 38 | Please note that this work is far from complete. Don't hesitate to report problems or propose improvements. 39 | 40 | 41 | # Licensing 42 | As a derived work from PySide6, the stubs are delivered under the LGPL v2.1 . See file LICENSE for more details. 43 | 44 | 45 | # Installation 46 | 47 | Install from pypi: 48 | 49 | $ pip install PySide6-stubs 50 | 51 | 52 | If you want to install the stable development version from the Git repository: 53 | 54 | $ pip install git+https://github.com/python-qt-tools/PySide6-stubs 55 | 56 | 57 | # Help improve the stubs 58 | 59 | If you notice incorrect or missing typing information (mypy reports errors eventhough your code is correct), please report it 60 | here with the following steps: 61 | 62 | * create an issue showing your problem 63 | * even better, create a PR to fix the problem. See [CONTRIBUTING.md] for details. 64 | 65 | You can also report typing issues directly to PySide here: https://bugreports.qt.io/secure/CreateIssue!default.jspa 66 | 67 | We track the list of issues reported to Qt here: [PYSIDE6_ISSUES.md] 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | With latest pyside6: 2 | - Slot is an object, convert our methods to object using callables -------------------------------------------------------------------------------- /mypy.ini: -------------------------------------------------------------------------------- 1 | # Global options: 2 | [mypy] 3 | 4 | # other --strict configuration 5 | warn_unused_configs = True 6 | disallow_any_generics = True 7 | disallow_subclassing_any = True 8 | disallow_untyped_defs = True 9 | disallow_incomplete_defs = True 10 | check_untyped_defs = True 11 | disallow_untyped_decorators = True 12 | no_implicit_optional = True 13 | warn_redundant_casts = True 14 | warn_unused_ignores = True 15 | warn_return_any = True 16 | no_implicit_reexport = True 17 | 18 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=42"] 3 | build-backend = "setuptools.build_meta" 4 | -------------------------------------------------------------------------------- /release_process.md: -------------------------------------------------------------------------------- 1 | Instructions for a new release: 2 | 3 | - update version in setup.cfg 4 | - update version in version.py 5 | - python -m build --wheel . 6 | - python -m build --sdist . 7 | - twine upload dist\pyside6_stubs-6.7.3.0.tar.gz dist\pyside6_stubs-6.7.3.0-py3-none-any.whl 8 | 9 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | 2 | PySide6==6.6.2.0 3 | mypy==1.4.1 4 | pytest 5 | libcst 6 | setuptools 7 | build 8 | twine 9 | -------------------------------------------------------------------------------- /scripts/README_scripts.md: -------------------------------------------------------------------------------- 1 | 2 | This directory contains script which apply fixes/transformation to the whole stub codebase. 3 | 4 | The scripts are designed so that they can be run multiple times on the codebase without damage, meaning 5 | they will only fix what has not already been fixed. 6 | 7 | The naming `collect_XXX` indicates that the script will collect information into a JSON file, to be reviewed. The 8 | next script with a naming `apply_XXX` takes the JSON file as input and performs the code transformation. 9 | 10 | 11 | -------------------------------------------------------------------------------- /scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python-qt-tools/PySide6-stubs/70dd77b526825b48cba61a5849d36c07041797eb/scripts/__init__.py -------------------------------------------------------------------------------- /scripts/apply_public_variables.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Optional, Union 2 | 3 | import pathlib 4 | import json 5 | 6 | import libcst 7 | import libcst as cst 8 | import libcst.matchers as matchers 9 | 10 | JSON_INPUT_FNAME = pathlib.Path(__file__).parent / 'public-variables.json' 11 | 12 | 13 | class TypingTransformer(cst.CSTTransformer): 14 | """TypingTransformer that visits classes and methods.""" 15 | 16 | def __init__(self, mod_name: str, d: Dict[str, str]) -> None: 17 | super().__init__() 18 | self.mod_name = mod_name 19 | self.full_name_stack = [mod_name] 20 | self.fqn_class_pub_var = d 21 | self.visited_attributes = [] 22 | 23 | def visit_ClassDef(self, node: cst.ClassDef) -> Optional[bool]: 24 | """Put a class on top of the stack when visiting.""" 25 | self.full_name_stack.append(node.name.value) 26 | return True 27 | 28 | def leave_AnnAssign(self, original_node: cst.AnnAssign, updated_node: cst.AnnAssign) \ 29 | -> cst.AnnAssign: 30 | fqn_class = '.'.join(self.full_name_stack) 31 | if fqn_class not in self.fqn_class_pub_var: 32 | return updated_node 33 | 34 | attr_ann_type_dict = self.fqn_class_pub_var[fqn_class] 35 | attr_name = original_node.target.value 36 | self.visited_attributes.append(attr_name) 37 | if attr_name not in attr_ann_type_dict: 38 | # we have no info about this attribute 39 | return updated_node 40 | 41 | ann_value = original_node.annotation.annotation.value 42 | if ann_value == attr_ann_type_dict[attr_name]: 43 | # we agree with annotation 44 | return updated_node 45 | 46 | # let's update the annotation 47 | print(f'Fixing {fqn_class}.{attr_name} from annotation "{ann_value}" to "{attr_ann_type_dict[attr_name]}"') 48 | annotation = updated_node.annotation.with_changes( 49 | annotation=type_to_expression(attr_ann_type_dict[attr_name]) 50 | ) 51 | return updated_node.with_changes(annotation=annotation) 52 | 53 | def leave_ClassDef(self, original_node: cst.ClassDef, updated_node: cst.ClassDef) \ 54 | -> Union[cst.BaseStatement, cst.FlattenSentinel[cst.BaseStatement], cst.RemovalSentinel, ]: 55 | fqn_class = '.'.join(self.full_name_stack) 56 | self.full_name_stack.pop() 57 | 58 | # no variables to adjust 59 | if fqn_class not in self.fqn_class_pub_var: 60 | return updated_node 61 | 62 | attr_ann_type_dict = self.fqn_class_pub_var[fqn_class] 63 | 64 | nonAnnotatedAttributes = set() 65 | 66 | for class_content in updated_node.body.body: 67 | if matchers.matches(class_content, matchers.SimpleStatementLine(body=[matchers.Assign()])): 68 | nonAnnotatedAttributes.add(class_content.body[0].targets[0].target.value) 69 | 70 | 71 | missingPubVar = sorted(set(attr_ann_type_dict.keys()) - nonAnnotatedAttributes - set(self.visited_attributes)) 72 | 73 | if not missingPubVar: 74 | # all public variables are already there 75 | return updated_node 76 | 77 | pre_body = [] 78 | for pub_var in missingPubVar: 79 | print(f'Class {fqn_class}: adding public variable {pub_var}: {attr_ann_type_dict[pub_var]}') 80 | pre_body.append(libcst.parse_statement(f'{pub_var}: {attr_ann_type_dict[pub_var]}')) 81 | pre_body.insert(0, libcst.EmptyLine(indent=False, newline=libcst.Newline())) 82 | pre_body.append(libcst.EmptyLine(indent=False, newline=libcst.Newline())) 83 | 84 | if isinstance(updated_node.body, libcst.SimpleStatementSuite): 85 | # the class is a single ellipsis, we need to create a full indented body 86 | return updated_node.with_changes( 87 | body=libcst.IndentedBlock(body=pre_body) 88 | ) 89 | 90 | # regular class 91 | return updated_node.with_changes( 92 | body=updated_node.body.with_changes( 93 | body=tuple(pre_body) + updated_node.body.body 94 | ) 95 | ) 96 | 97 | 98 | def type_to_expression(typ: str) -> cst.BaseExpression: 99 | if '.' not in typ: 100 | return cst.Name(typ) 101 | left, right = typ.rsplit('.', 1) 102 | return cst.Attribute( 103 | value=type_to_expression(left), attr=cst.Name(right) 104 | ) 105 | 106 | 107 | def apply_public_variables_for_module(module_path: str, d: Dict[str, str]) -> None: 108 | if module_path.name.startswith('_'): 109 | return 110 | 111 | module_name = module_path.stem 112 | 113 | print('Fixing ', module_name) 114 | with open(module_path, "r", encoding="utf-8") as fhandle: 115 | stub_tree = cst.parse_module(fhandle.read()) 116 | 117 | transformer = TypingTransformer(module_name, d) 118 | modified_tree = stub_tree.visit(transformer) 119 | 120 | with open(module_path, "w", encoding="utf-8") as fhandle: 121 | fhandle.write(modified_tree.code) 122 | 123 | 124 | def main(): 125 | with open(JSON_INPUT_FNAME, 'r') as f: 126 | d = json.load(f) 127 | 128 | for fpath in (pathlib.Path(__file__).parent.parent / 'PySide6-stubs').glob('*.pyi'): 129 | apply_public_variables_for_module(fpath, d) 130 | 131 | 132 | 133 | if __name__ == '__main__': 134 | # auto_test() 135 | main() 136 | -------------------------------------------------------------------------------- /scripts/apply_signals.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Optional, Union 2 | 3 | import pathlib, json 4 | 5 | import libcst 6 | import libcst as cst 7 | import libcst.matchers as matchers 8 | 9 | from utils import resolve_cst_attr 10 | 11 | JSON_INPUT_FNAME = pathlib.Path(__file__).parent / 'class-signals.json' 12 | 13 | SIGNAL_ANNOTATION = 'ClassVar[Signal]' 14 | SIGNAL_ANNOTATION_ASSIGN = '= ...' 15 | CST_SIGNAL_ANNOTATION = libcst.parse_statement(SIGNAL_ANNOTATION).body[0] 16 | 17 | 18 | class TypingTransformer(cst.CSTTransformer): 19 | """TypingTransformer that visits classes and methods.""" 20 | 21 | def __init__(self, mod_name: str, d: Dict[str, str]) -> None: 22 | super().__init__() 23 | self.mod_name = mod_name 24 | self.full_name_stack = [mod_name] 25 | self.fqn_class_signals = d 26 | self.annotation = [] 27 | 28 | 29 | def visit_ClassDef(self, node: cst.ClassDef) -> Optional[bool]: 30 | """Put a class on top of the stack when visiting.""" 31 | self.full_name_stack.append( node.name.value ) 32 | return True 33 | 34 | 35 | def leave_ClassDef(self, original_node: cst.ClassDef, updated_node: cst.ClassDef) \ 36 | -> Union[cst.BaseStatement, cst.FlattenSentinel[cst.BaseStatement], cst.RemovalSentinel, ]: 37 | fqn_class = '.'.join(self.full_name_stack) 38 | self.full_name_stack.pop() 39 | if not 'QAbstractAnimation' in fqn_class: 40 | return original_node 41 | 42 | # no signals to adjust 43 | if not fqn_class in self.fqn_class_signals: 44 | return updated_node 45 | 46 | collected_signals = set(self.fqn_class_signals[fqn_class]) 47 | 48 | nonAnnotatedAttributes = set() 49 | annotatedAttributes = set() 50 | 51 | updated_node_body_body = [] 52 | changes = False 53 | for i, class_content in enumerate(updated_node.body.body): 54 | new_class_content = class_content 55 | if matchers.matches(class_content, matchers.SimpleStatementLine(body=[matchers.Assign()])): 56 | nonAnnotatedAttributes.add(class_content.body[0].targets[0].target.value) 57 | 58 | if matchers.matches(class_content, matchers.SimpleStatementLine(body=[matchers.AnnAssign()])): 59 | body_0 = new_class_content.body[0] 60 | annotatedAttributes.add(body_0.target.value) 61 | annotation = body_0.annotation.annotation 62 | if resolve_cst_attr(annotation) != SIGNAL_ANNOTATION: 63 | print('Fixing Annotation: ', f'{fqn_class}.{body_0.target.value} to {SIGNAL_ANNOTATION}' ) 64 | body_0 = body_0.with_changes( 65 | annotation=body_0.annotation.with_changes( annotation=CST_SIGNAL_ANNOTATION ) 66 | ) 67 | new_class_content = new_class_content.with_changes(body=(body_0,) + class_content.body[1:]) 68 | changes = True 69 | 70 | updated_node_body_body.append( new_class_content ) 71 | 72 | if changes: 73 | updated_node = updated_node.with_changes( 74 | body=updated_node.body.with_changes( 75 | body=tuple(updated_node_body_body) 76 | ) 77 | ) 78 | 79 | missingSignals = sorted(collected_signals - nonAnnotatedAttributes - annotatedAttributes) 80 | 81 | if missingSignals: 82 | pre_body = [] 83 | for signal in missingSignals: 84 | print(f'Class {fqn_class}: adding signal {signal}') 85 | pre_body.append(libcst.parse_statement(f'{signal}: {SIGNAL_ANNOTATION} {SIGNAL_ANNOTATION_ASSIGN}')) 86 | pre_body.insert(0, libcst.EmptyLine(indent=False, newline=libcst.Newline())) 87 | pre_body.append(libcst.EmptyLine(indent=False, newline=libcst.Newline())) 88 | 89 | if isinstance(updated_node.body, libcst.SimpleStatementSuite): 90 | # the class is a single ellipsis, we need to create a full indented body 91 | return updated_node.with_changes( 92 | body=libcst.IndentedBlock(body=pre_body) 93 | ) 94 | 95 | # regular class 96 | updated_node = updated_node.with_changes( 97 | body=updated_node.body.with_changes( 98 | body=tuple(pre_body) + updated_node.body.body 99 | ) 100 | ) 101 | 102 | # all signals are already there 103 | return updated_node 104 | 105 | 106 | def apply_signals_for_module(module_path: str, d: Dict[str, str]) -> None: 107 | if module_path.name.startswith('_'): 108 | return 109 | 110 | module_name = module_path.stem 111 | 112 | print('Fixing module ', module_name) 113 | with open(module_path, "r", encoding="utf-8") as fhandle: 114 | stub_tree = cst.parse_module(fhandle.read()) 115 | 116 | transformer = TypingTransformer(module_name, d) 117 | modified_tree = stub_tree.visit(transformer) 118 | 119 | with open(module_path, "w", encoding="utf-8") as fhandle: 120 | fhandle.write(modified_tree.code) 121 | 122 | 123 | def main(): 124 | with open(JSON_INPUT_FNAME, 'r') as f: 125 | d = json.load(f) 126 | 127 | for fpath in (pathlib.Path(__file__).parent.parent / 'PySide6-stubs').glob('QtCore.pyi'): 128 | apply_signals_for_module(fpath, d) 129 | 130 | 131 | 132 | if __name__ == '__main__': 133 | # auto_test() 134 | main() 135 | -------------------------------------------------------------------------------- /scripts/collect_public_variables.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Type 2 | 3 | import importlib, json, pathlib 4 | 5 | from PySide6.QtWidgets import QApplication 6 | 7 | JSON_OUTPUT_FNAME = pathlib.Path(__file__).parent / 'public-variables.json' 8 | 9 | RESERVED_KEYWORDS = [ 10 | 'from', 11 | 'QRhiResource', 12 | 'QRhiTexture', 13 | 'QRhiBuffer', 14 | 'QRhiSampler', 15 | 'QRhiShaderResourceBinding', 16 | 'QTimeZone', 17 | ] 18 | 19 | def collect_public_variables_for_module(module_name: str, d: Dict[str, str]) -> None: 20 | '''Load module, inspect all attribute types and fill dict with information''' 21 | if module_name.startswith('_'): 22 | return 23 | 24 | print('Processing %s' % module_name) 25 | try: 26 | m = importlib.import_module(f'PySide6.{module_name}') 27 | except (ModuleNotFoundError, ImportError): 28 | print('... Module not available!') 29 | # platform-specific modules can not be imported for example on other platforms 30 | return 31 | 32 | module_attributes = set(dir(m)) | set(m.__dict__.keys()) 33 | for class_name in module_attributes: 34 | if class_name.startswith('_'): 35 | continue 36 | 37 | if class_name in RESERVED_KEYWORDS: 38 | continue 39 | 40 | class_type = getattr(m, class_name) 41 | print(f'collecting {module_name}.{class_name}') 42 | collect_public_variables_for_class(f'{module_name}.{class_name}', class_type, d) 43 | 44 | 45 | def collect_public_variables_for_class(class_fqn: str, class_type: Type, d: Dict[str, str]) -> None: 46 | # we only care about classes 47 | #print(f'trying to access {class_fqn}.__dict__ for {type(class_type)}') 48 | try: 49 | class_members = class_type.__dict__.items() 50 | except AttributeError: 51 | # this is not a class 52 | return 53 | 54 | #print(f'Iterating class members of {class_fqn}') 55 | instance = None 56 | for class_attr_name, class_attr_value in class_members: 57 | if class_attr_name.startswith('_'): 58 | continue 59 | 60 | if class_attr_name in RESERVED_KEYWORDS: 61 | continue 62 | 63 | if class_attr_value.__class__.__name__ in ('getset_descriptor', 'method_descriptor'): 64 | 65 | # create the instance on-demand 66 | if instance is None: 67 | try: 68 | instance = class_type() 69 | except Exception: 70 | # we can not work without the instance 71 | return 72 | 73 | attr_of_instance = getattr(instance, class_attr_name) 74 | if attr_of_instance == None: 75 | continue 76 | typename = attr_of_instance.__class__.__qualname__ 77 | modulename = attr_of_instance.__class__.__module__ 78 | if modulename != "builtins": 79 | typename = f'{modulename}.{typename}' 80 | 81 | try: 82 | pub_var_dict = d[class_fqn] 83 | except KeyError: 84 | pub_var_dict = {} 85 | d[class_fqn] = pub_var_dict 86 | pub_var_dict[class_attr_name] = typename 87 | else: 88 | # try if it is a subclass 89 | collect_public_variables_for_class(f'{class_fqn}.{class_attr_name}', class_attr_value, d) 90 | 91 | 92 | def main(): 93 | application = QApplication(['-platform', 'minimal']) # needed for instancing QWidgets 94 | d = {} 95 | for fpath in (pathlib.Path(__file__).parent.parent / 'PySide6-stubs').glob('QtNfc.pyi'): 96 | module_name = fpath.stem 97 | collect_public_variables_for_module(module_name, d) 98 | 99 | with open(JSON_OUTPUT_FNAME, 'w') as f: 100 | json.dump(d, f, indent=4) 101 | 102 | 103 | 104 | if __name__ == '__main__': 105 | main() -------------------------------------------------------------------------------- /scripts/collect_signals.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Type 2 | 3 | import importlib, json, pathlib 4 | 5 | from PySide6.QtCore import Signal 6 | 7 | JSON_OUTPUT_FNAME = pathlib.Path(__file__).parent / 'class-signals.json' 8 | 9 | def collect_class_signals_for_module(module_name: str, d: Dict[str, str]) -> None: 10 | '''Load module, inspect all attribute types and fill dict with signals one''' 11 | if module_name.startswith('_'): 12 | return 13 | 14 | print('Processing %s' % module_name) 15 | try: 16 | m = importlib.import_module(f'PySide6.{module_name}') 17 | except ModuleNotFoundError: 18 | print('... Module not available!') 19 | # platform-specific modules can not be imported for example on other platforms 20 | return 21 | 22 | for class_name, class_type in m.__dict__.items(): 23 | if class_name.startswith('_'): 24 | continue 25 | 26 | collect_class_signals_for_class(f'{module_name}.{class_name}', class_type, d) 27 | 28 | def collect_class_signals_for_class(class_fqn: str, class_type: Type, d: Dict[str, str]) -> None: 29 | # we only care about classes 30 | try: 31 | class_members = class_type.__dict__.items() 32 | except AttributeError: 33 | # this is not a class 34 | return 35 | 36 | for class_attr_name, class_attr_value in class_members: 37 | if class_attr_name.startswith('_'): 38 | continue 39 | 40 | # tricky way to find an instance of Shiboken.EnumType 41 | if isinstance(class_attr_value, Signal): 42 | d[class_fqn] = d.get(class_fqn, list()) 43 | d[class_fqn].append(class_attr_name) 44 | else: 45 | collect_class_signals_for_class(f'{class_fqn}.{class_attr_name}', class_attr_value, d) 46 | 47 | 48 | def main(): 49 | d = {} 50 | for fpath in (pathlib.Path(__file__).parent.parent / 'PySide6-stubs').glob('*.pyi'): 51 | module_name = fpath.stem 52 | collect_class_signals_for_module(module_name, d) 53 | 54 | with open(JSON_OUTPUT_FNAME, 'w') as f: 55 | json.dump(d, f, indent=4) 56 | 57 | 58 | 59 | if __name__ == '__main__': 60 | main() -------------------------------------------------------------------------------- /scripts/utils.py: -------------------------------------------------------------------------------- 1 | import pathlib 2 | from typing import Union, Dict, Optional 3 | 4 | import libcst as cst 5 | 6 | 7 | def resolve_cst_attr(node: Union[cst.Name, cst.Attribute, cst.Subscript, cst.SubscriptElement, cst.Index]) -> str: 8 | '''Return a string from an annotation node''' 9 | if isinstance(node, cst.Name): 10 | return node.value 11 | 12 | if isinstance(node, cst.Attribute): 13 | return f'{resolve_cst_attr(node.value)}.{resolve_cst_attr(node.attr)}' 14 | 15 | if isinstance(node, cst.Subscript): 16 | return f'{resolve_cst_attr(node.value)}[{", ".join(resolve_cst_attr(el) for el in node.slice)}]' 17 | 18 | if isinstance(node, cst.SubscriptElement): 19 | return resolve_cst_attr(node.slice) 20 | 21 | if isinstance(node, cst.Index): 22 | return resolve_cst_attr(node.value) 23 | 24 | if isinstance(node, cst.SimpleString): 25 | return node.value 26 | 27 | if isinstance(node, cst.Call): 28 | return f'{resolve_cst_attr(node.func)}({", ".join(resolve_cst_attr(arg) for arg in node.args)})' 29 | 30 | if isinstance(node, cst.Arg): 31 | return resolve_cst_attr(node.value) 32 | 33 | raise ValueError('Unknown type: ', type(node), node) 34 | 35 | 36 | def self_test(): 37 | assert resolve_cst_attr(cst.parse_expression('PySide6.QtGui.QCursor')) == 'PySide6.QtGui.QCursor' 38 | assert resolve_cst_attr(cst.parse_expression('PySide6.QtGui.QCursor ')) == 'PySide6.QtGui.QCursor' 39 | assert resolve_cst_attr(cst.parse_expression('Union[PySide6.QtGui.QCursor] ')) == 'Union[PySide6.QtGui.QCursor]' 40 | assert resolve_cst_attr(cst.parse_expression('Union[PySide6.QtGui.QCursor ] ')) == 'Union[PySide6.QtGui.QCursor]' 41 | assert resolve_cst_attr(cst.parse_expression('Union[PySide6.QtGui.QCursor, aa.bb ] ')) == 'Union[PySide6.QtGui.QCursor, aa.bb]' 42 | print('Self-test: OK') 43 | 44 | 45 | class FixAutoConversionTypingTransformer(cst.CSTTransformer): 46 | """TypingTransformer that visits classes and methods.""" 47 | 48 | def __init__(self, mod_name: str, d: Dict[str, str], target_annotation, replacement_annotation) -> None: 49 | super().__init__() 50 | self.full_name_stack = [mod_name] 51 | self.d = d 52 | self.target_annotation = target_annotation 53 | self.replacement_annotation = replacement_annotation 54 | 55 | def fqn_name(self) -> str: 56 | return '.'.join(self.full_name_stack) 57 | 58 | 59 | def visit_ClassDef(self, node: cst.ClassDef) -> Optional[bool]: 60 | """Put a class on top of the stack when visiting.""" 61 | self.full_name_stack.append( node.name.value ) 62 | return True 63 | 64 | def visit_FunctionDef(self, node: cst.FunctionDef) -> Optional[bool]: 65 | # search for all arguments with type annotation 66 | self.full_name_stack.append( node.name.value ) 67 | 68 | 69 | def leave_FunctionDef(self, original_node: cst.FunctionDef, updated_node: cst.FunctionDef) -> None: 70 | fqn_name = self.fqn_name() 71 | self.full_name_stack.pop() 72 | 73 | for i, param in enumerate(updated_node.params.params): 74 | fqn_param = '%s().%s' % (fqn_name, param.name.value) 75 | fqn_annotation = '' 76 | if param.annotation: 77 | fqn_annotation = resolve_cst_attr(param.annotation.annotation) 78 | if (fqn_annotation == self.target_annotation): 79 | self.d['collected'][fqn_param] = 'QCursor' 80 | # print('Node before: ', updated_node) 81 | print('Fixing: ', fqn_param, fqn_annotation) 82 | updated_node = updated_node.with_changes( 83 | params=updated_node.params.with_changes( 84 | params=updated_node.params.params[:i] 85 | + (updated_node.params.params[i].with_changes(annotation=cst.Annotation(annotation=cst.parse_expression(self.replacement_annotation))),) 86 | + updated_node.params.params[i+1:] 87 | ) 88 | ) 89 | # print('Node after: ', updated_node) 90 | self.d['fixed'][fqn_param] = 'QCursor' 91 | 92 | return updated_node 93 | 94 | 95 | 96 | def leave_ClassDef(self, original_node: cst.ClassDef, updated_node: cst.ClassDef) \ 97 | -> Union[cst.BaseStatement, cst.FlattenSentinel[cst.BaseStatement], cst.RemovalSentinel,]: 98 | """Remove a class from the stack and return the updated node.""" 99 | self.full_name_stack.pop() 100 | return updated_node 101 | 102 | 103 | def fix_auto_conversion_for_module(module_path: pathlib.Path, d: Dict[str, str], target_annotation, replacement_annotation) -> None: 104 | '''Load module, inspect all QFlags types and fill dict with the information''' 105 | module_name = module_path.stem 106 | if module_name.startswith('_'): 107 | return 108 | 109 | print('Processing %s' % module_name) 110 | if module_name.startswith('_'): 111 | return 112 | 113 | with open(module_path, "r", encoding="utf-8") as fhandle: 114 | stub_tree = cst.parse_module(fhandle.read()) 115 | 116 | transformer = FixAutoConversionTypingTransformer(module_name, d, target_annotation, replacement_annotation) 117 | modified_tree = stub_tree.visit(transformer) 118 | 119 | with open(module_path, "w", encoding="utf-8") as fhandle: 120 | fhandle.write(modified_tree.code) -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = PySide6-stubs 3 | author = Philippe Fremy 4 | author_email = phil.fremy@free.fr 5 | description = PEP561 stub files for the *Qt for Python/PySide6* framework 6 | long_description = file: README.md 7 | long_description_content_type = text/markdown 8 | version = 6.7.3.0 9 | license = LGPL v2.1 10 | url = https://github.com/python-qt-tools/PySide6-stubs 11 | project_urls = 12 | Bug Tracker = https://github.com/python-qt-tool/pyside6-stubs/issues 13 | classifiers = 14 | Development Status :: 5 - Production/Stable 15 | Programming Language :: Python :: 3 16 | License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2) 17 | Operating System :: OS Independent 18 | Intended Audience :: Developers 19 | Typing :: Stubs Only 20 | 21 | [options] 22 | zip_safe = False 23 | package_dir = 24 | PySide6-stubs = PySide6-stubs 25 | shiboken6-stubs = shiboken6-stubs 26 | 27 | python_requires = >=3.7 28 | install_requires = 29 | mypy>=1.0 30 | PySide6>=6.0 31 | 32 | [options.package_data] 33 | * = *.pyi 34 | 35 | [options.packages.find] 36 | exclude = 37 | update_latest_pyside6.py 38 | 39 | 40 | [options.extras_require] 41 | dev = 42 | pytest -------------------------------------------------------------------------------- /shiboken6-stubs/Shiboken.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | """ 5 | This file contains the exact signatures for all functions in module 6 | Shiboken, except for defaults which are replaced by "...". 7 | """ 8 | 9 | class Object(object): 10 | def __init__(self) -> None: ... 11 | 12 | class Enum(object): ... 13 | 14 | 15 | class VoidPtr(object): 16 | def __init__(self, value: int) -> None: ... 17 | 18 | 19 | def _unpickle_enum(arg__1: object, arg__2: object) -> object: ... 20 | def createdByPython(arg__1: Object) -> bool: ... 21 | def delete(arg__1: Object) -> None: ... 22 | def dump(arg__1: object) -> str: ... 23 | def getAllValidWrappers() -> list[Object]: ... 24 | def getCppPointer(arg__1: Object) -> tuple[int, ...]: ... 25 | def invalidate(arg__1: Object) -> None: ... 26 | def isValid(arg__1: object) -> bool: ... 27 | def ownedByPython(arg__1: Object) -> bool: ... 28 | def wrapInstance(arg__1: int, arg__2: type) -> Object: ... 29 | 30 | 31 | # eof 32 | -------------------------------------------------------------------------------- /shiboken6-stubs/__init__.pyi: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Object: ... -------------------------------------------------------------------------------- /shiboken6-stubs/shiboken6.pyi: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 The Qt Company Ltd. 2 | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only 3 | 4 | """ 5 | This file contains the exact signatures for all functions in module 6 | Shiboken, except for defaults which are replaced by "...". 7 | """ 8 | 9 | class Object(object): 10 | def __init__(self) -> None: ... 11 | 12 | class VoidPtr(object): ... 13 | 14 | 15 | def createdByPython(arg__1: Object) -> bool: ... 16 | def delete(arg__1: Object) -> None: ... 17 | def dump(arg__1: object) -> str: ... 18 | def getAllValidWrappers() -> list[Object]: ... 19 | def getCppPointer(arg__1: Object) -> tuple[int, ...]: ... 20 | def invalidate(arg__1: Object) -> None: ... 21 | def isValid(arg__1: object) -> bool: ... 22 | def ownedByPython(arg__1: Object) -> bool: ... 23 | def wrapInstance(arg__1: int, arg__2: type) -> Object: ... 24 | 25 | 26 | # eof 27 | -------------------------------------------------------------------------------- /tests/QState.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import QObject 2 | from PySide6.QtStateMachine import QState, QFinalState 3 | 4 | 5 | b = QObject() 6 | 7 | 8 | 9 | s = QState() 10 | ### Note: this seems to be a Qt bug that this is not supported 11 | s.assignProperty(b,"string", True) 12 | 13 | abst = QFinalState() 14 | ### Note: this seems to be a Qt bug that this is not supported 15 | # s.addTransition(b,'string', abst) 16 | 17 | try: 18 | ### Note: this seems to be a Qt bug that this is not supported 19 | s.assignProperty(b, b'bytes', True) # type: ignore[arg-type] 20 | assert False, 'ValueError should have been raised' 21 | pass 22 | except (ValueError, TypeError): 23 | # good, we get confirmation that string is the right type 24 | pass 25 | 26 | 27 | try: 28 | ### Note: this seems to be a Qt bug that this is not supported 29 | s.addTransition(b, b'bytes', abst) # type: ignore[call-overload] 30 | assert False, 'ValueError should have been raised' 31 | pass 32 | except (ValueError, TypeError): 33 | # good, we get confirmation that string is the right type 34 | pass 35 | 36 | -------------------------------------------------------------------------------- /tests/alignment_flag.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import Qt 2 | from PySide6.QtWidgets import QSpinBox, QFormLayout, QGraphicsView, QLineEdit, QLabel, QLayout, QLayoutItem, QProgressBar, \ 3 | QScrollArea, QTextEdit 4 | 5 | a = QSpinBox() 6 | a.setAlignment(Qt.AlignmentFlag.AlignRight) 7 | 8 | b = QGraphicsView() 9 | b.setAlignment(Qt.AlignmentFlag.AlignRight) 10 | 11 | l = QLabel() 12 | l.setAlignment(Qt.AlignmentFlag.AlignRight) 13 | 14 | d = QLineEdit() 15 | d.setAlignment(Qt.AlignmentFlag.AlignRight) 16 | 17 | pb = QProgressBar() 18 | pb.setAlignment(Qt.AlignmentFlag.AlignRight) 19 | 20 | sa = QScrollArea() 21 | sa.setAlignment(Qt.AlignmentFlag.AlignRight) 22 | 23 | te = QTextEdit() 24 | te.setAlignment(Qt.AlignmentFlag.AlignRight) 25 | 26 | fl = QFormLayout() 27 | fl.setFormAlignment(Qt.AlignmentFlag.AlignRight) 28 | fl.setAlignment(Qt.AlignmentFlag.AlignRight) 29 | fl.setAlignment(fl, Qt.AlignmentFlag.AlignRight) 30 | fl.setAlignment(b, Qt.AlignmentFlag.AlignRight) 31 | 32 | -------------------------------------------------------------------------------- /tests/qaction.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtGui import QAction 2 | 3 | a = QAction() 4 | a.setShortcut('Ctrl+F') -------------------------------------------------------------------------------- /tests/qapplication.py: -------------------------------------------------------------------------------- 1 | from typing import Any, cast, overload 2 | 3 | from PySide6.QtWidgets import QApplication 4 | 5 | def slotAppStateChanged(*args: Any) -> None: 6 | pass 7 | 8 | def slotFocusChanged(*args: Any) -> None: 9 | pass 10 | 11 | app = cast(QApplication, QApplication.instance()) 12 | app.applicationStateChanged.connect(slotAppStateChanged) 13 | app.focusChanged.connect(slotFocusChanged) 14 | QApplication.processEvents() 15 | 16 | # deactivated because of mypy bug: https://github.com/python/mypy/issues/7781 17 | # app.processEvents() 18 | -------------------------------------------------------------------------------- /tests/qbytearray.py: -------------------------------------------------------------------------------- 1 | from PySide6 import QtCore 2 | 3 | some_bytes = b'123' 4 | some_bytearray = QtCore.QByteArray(3, 'a') 5 | some_bytes = bytes(some_bytearray) 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/qcolumnview.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QColumnView 2 | 3 | 4 | v = QColumnView() 5 | v.setModel(None) -------------------------------------------------------------------------------- /tests/qcoreapplication.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import QCoreApplication 2 | 3 | s = 'abc' 4 | s = QCoreApplication.translate("GitFlowAdvanceIntBranch", u"hidden", None) 5 | s = QCoreApplication.translate("GitFlowAdvanceIntBranch", u"hidden", 'some help') 6 | -------------------------------------------------------------------------------- /tests/qdatetime.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from PySide6.QtCore import QDateTime, QDate 3 | 4 | dt = datetime(2000,1,1) 5 | QDateTime(dt) 6 | QDate(dt) 7 | QDate(dt.date()) 8 | -------------------------------------------------------------------------------- /tests/qdbusabstractinterface.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | 4 | if sys.platform == 'linux' and 0: 5 | ### To be tested under linux 6 | from QtDBus import QDBusAbstractInterface, QDBus, QDBusInterface 7 | 8 | iface = QDBusInterface() 9 | iface.asyncCall(method='toto') 10 | iface.asyncCall('toto', 1, b'abc', '123') 11 | iface.call(method='toto') 12 | iface.call('toto', 1, b'abc', '123') 13 | iface.call('toto', 1, b'abc', '123') 14 | iface.call(QDBus.Block, 'toto') 15 | iface.call(QDBus.Block, 'toto', 1, b'abc', '123') 16 | -------------------------------------------------------------------------------- /tests/qdialog.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QDialog 2 | 3 | 4 | d = QDialog() 5 | f = d.exec_ 6 | f = d.exec 7 | -------------------------------------------------------------------------------- /tests/qdialogbuttonbox.py: -------------------------------------------------------------------------------- 1 | from PySide6 import QtWidgets 2 | 3 | a: QtWidgets.QDialogButtonBox.StandardButton 4 | a = (QtWidgets.QDialogButtonBox.StandardButton.Ok | QtWidgets.QDialogButtonBox.StandardButton.Ok) 5 | d = (a | QtWidgets.QDialogButtonBox.StandardButton.Ok) # type: QtWidgets.QDialogButtonBox.StandardButton 6 | e = a | a # type: QtWidgets.QDialogButtonBox.StandardButton 7 | -------------------------------------------------------------------------------- /tests/qfiledialog.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QFileDialog 2 | from PySide6.QtCore import QUrl 3 | 4 | 5 | def call_me() -> None: 6 | fname, filter = '', '' 7 | fnames = ['', ''] 8 | 9 | url = QUrl() 10 | urls = [url] 11 | 12 | fname, filter = QFileDialog.getOpenFileName(None, caption='getOPenFileName') 13 | print(fname, filter) 14 | assert type(fname) == str 15 | assert type(filter) == str 16 | 17 | fnames, filter = QFileDialog.getOpenFileNames(None, caption='getOpenFileNames') 18 | print(fnames, filter) 19 | assert type(fnames) == list 20 | if fnames: 21 | assert type(fnames[0]) == str 22 | assert type(filter) == str 23 | 24 | fname, filter = QFileDialog.getSaveFileName(None, caption='getSaveFileName') 25 | print(fname, filter) 26 | assert type(fname) == str 27 | assert type(filter) == str 28 | 29 | url, filter = QFileDialog.getOpenFileUrl(None, caption='getOpenFileUrl') 30 | print(url, filter) 31 | assert type(url) == QUrl 32 | assert type(filter) == str 33 | 34 | urls, filter = QFileDialog.getOpenFileUrls(None, caption='getOpenFileUrls') 35 | print(urls, filter) 36 | assert type(urls) == list 37 | if urls: 38 | assert type(urls[0]) == QUrl 39 | assert type(filter) == str 40 | 41 | url, filter = QFileDialog.getSaveFileUrl(None, caption='getSaveFileUrl') 42 | print(url, filter) 43 | assert type(url) == QUrl 44 | assert type(filter) == str 45 | 46 | 47 | 48 | 49 | # Enable me if you are ready to click 5 times on the dialog 50 | # call_me() -------------------------------------------------------------------------------- /tests/qflag.py: -------------------------------------------------------------------------------- 1 | 2 | from PySide6.QtCore import Qt 3 | from PySide6.QtWidgets import QApplication, QDialog 4 | 5 | # I need to run this script manually to verify it works 6 | if __name__ == '__main__': 7 | app = QApplication([]) 8 | 9 | w = QDialog() 10 | w.setWindowFlags(w.windowFlags() | Qt.WindowType.WindowContextHelpButtonHint) 11 | w.setWindowFlags(Qt.WindowType.WindowMinimizeButtonHint | Qt.WindowType.WindowContextHelpButtonHint) 12 | w.setWindowFlags(Qt.WindowType.WindowContextHelpButtonHint) 13 | w.setWindowFlag(Qt.WindowType.WindowContextHelpButtonHint) 14 | 15 | try: 16 | w.setWindowFlag(Qt.WindowType.WindowMinimizeButtonHint | Qt.WindowType.WindowContextHelpButtonHint) 17 | except TypeError: 18 | pass 19 | 20 | if __name__ == '__main__': 21 | w.show() 22 | app.exec() 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/qguiapplication.py: -------------------------------------------------------------------------------- 1 | from typing import cast 2 | 3 | from PySide6.QtGui import QGuiApplication 4 | from PySide6.QtCore import Qt 5 | 6 | app = cast(QGuiApplication, QGuiApplication.instance()) 7 | app.setOverrideCursor(Qt.CursorShape.WaitCursor) 8 | -------------------------------------------------------------------------------- /tests/qheaderview.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QHeaderView 2 | from PySide6.QtCore import Qt 3 | 4 | 5 | v = QHeaderView(Qt.Orientation.Horizontal) 6 | v.setModel(None) -------------------------------------------------------------------------------- /tests/qicon.py: -------------------------------------------------------------------------------- 1 | from PySide6 import QtGui 2 | 3 | icon = QtGui.QIcon() 4 | icon.addPixmap(QtGui.QPixmap(":/img/multigit-logo-256.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) 5 | 6 | -------------------------------------------------------------------------------- /tests/qinputdialog.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | from PySide6.QtWidgets import QInputDialog 4 | 5 | text: str 6 | int_value: int 7 | float_value: float 8 | 9 | if TYPE_CHECKING: 10 | text, ok = QInputDialog.getText( 11 | None, 12 | "Title", 13 | "Please enter some value:", 14 | ) 15 | 16 | text, ok = QInputDialog.getMultiLineText( 17 | None, 18 | "Title", 19 | "Please enter some value:", 20 | ) 21 | 22 | text, ok = QInputDialog.getItem( 23 | None, 24 | "Title", 25 | "Please enter some value:", 26 | ['aaaa', 'bbbb', 'cccc'] 27 | ) 28 | 29 | int_value, ok = QInputDialog.getInt( 30 | None, 31 | "Title", 32 | "Please enter some value:", 33 | ) 34 | 35 | float_value, ok = QInputDialog.getDouble( 36 | None, 37 | "Title", 38 | "Please enter some value:", 39 | ) 40 | -------------------------------------------------------------------------------- /tests/qlabel.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QLabel 2 | from PySide6.QtCore import Qt 3 | 4 | l = QLabel() 5 | l.setAlignment(Qt.AlignmentFlag.AlignCenter) 6 | -------------------------------------------------------------------------------- /tests/qlayout.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QGridLayout, QHBoxLayout, QVBoxLayout, QLayout 2 | 3 | a = QGridLayout(parent=None) 4 | b = QHBoxLayout(parent=None) 5 | c = QVBoxLayout(parent=None) 6 | -------------------------------------------------------------------------------- /tests/qlineedit.py: -------------------------------------------------------------------------------- 1 | """Tests for QLineEdit.""" 2 | import string 3 | 4 | from PySide6.QtWidgets import QApplication, QLineEdit 5 | 6 | # test that QLineEdit.setText() accepts None as parameter 7 | edit = QLineEdit() 8 | edit.setText(None) 9 | -------------------------------------------------------------------------------- /tests/qlistview.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QListView 2 | 3 | 4 | v = QListView() 5 | v.setModel(None) -------------------------------------------------------------------------------- /tests/qlistwidget.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from PySide6.QtWidgets import QListWidget, QListWidgetItem 4 | 5 | l = QListWidget() 6 | 7 | item = QListWidgetItem(l) 8 | 9 | # it should be possible to remove the item widget for an item 10 | l.setItemWidget(item, None) 11 | 12 | 13 | -------------------------------------------------------------------------------- /tests/qmenu.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from PySide6.QtWidgets import QMenu, QTreeWidget 3 | 4 | # the default version of pyside2 stubs would not detect missing attributes 5 | # this test verifies that this is fixed 6 | 7 | class Toto(QTreeWidget): 8 | 9 | m: QMenu 10 | 11 | def __init__(self, *args: Any) -> None: 12 | super().__init__(*args) 13 | self.m = QMenu() 14 | 15 | def toto(self) -> None: 16 | try: 17 | self.m.exec() 18 | assert False, 'Should not reach here' 19 | except AttributeError: 20 | pass 21 | try: 22 | self.m.exec_() 23 | assert False, 'Should not reach here' 24 | except AttributeError: 25 | pass -------------------------------------------------------------------------------- /tests/qmessagebox.py: -------------------------------------------------------------------------------- 1 | from typing import Callable 2 | 3 | from PySide6.QtWidgets import QMessageBox, QWidget 4 | 5 | multiple_buttons = QMessageBox.StandardButton(0) 6 | multiple_buttons = (QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Ok) 7 | multiple_buttons = QMessageBox.StandardButton.Ok | 0 8 | multiple_buttons = multiple_buttons | 0 9 | multiple_buttons = (multiple_buttons | QMessageBox.StandardButton.Ok) 10 | multiple_buttons = multiple_buttons | multiple_buttons 11 | multiple_buttons = QMessageBox.StandardButton(44) 12 | multiple_buttons = QMessageBox.StandardButton(QMessageBox.StandardButton.Ok) 13 | multiple_buttons = QMessageBox.StandardButton(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Ok) 14 | 15 | one_button: QMessageBox.StandardButton 16 | one_button = QMessageBox.StandardButton.Ok 17 | one_button = QMessageBox.StandardButton(44) 18 | one_button = QMessageBox.StandardButton(QMessageBox.StandardButton.Ok) 19 | 20 | -------------------------------------------------------------------------------- /tests/qmessagebox2.py: -------------------------------------------------------------------------------- 1 | from typing import Callable 2 | from PySide6.QtWidgets import QMessageBox, QWidget 3 | 4 | my_msgbox_function: Callable[[QWidget, str, str, QMessageBox.StandardButton, QMessageBox.StandardButton], QMessageBox.StandardButton] 5 | my_msgbox_function = QMessageBox.warning 6 | my_msgbox_function = QMessageBox.information 7 | my_msgbox_function = QMessageBox.critical 8 | my_msgbox_function = QMessageBox.question 9 | 10 | my_about_qt: Callable[[None, str], None] 11 | my_about_qt = QMessageBox.aboutQt 12 | my_about: Callable[[None, str, str], None] 13 | my_about = QMessageBox.about 14 | 15 | if 0: 16 | QMessageBox.information(None, 'info', 'info') 17 | QMessageBox.warning(None, 'warning', 'warning') 18 | QMessageBox.critical(None, 'critical', 'critical') 19 | QMessageBox.question(None, 'question', 'question') 20 | QMessageBox.about(None, 'about', 'about') 21 | QMessageBox.aboutQt(None, 'aboutQt') 22 | -------------------------------------------------------------------------------- /tests/qmodelindex.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import QModelIndex 2 | 3 | m = QModelIndex() 4 | 5 | i: int 6 | s: str 7 | 8 | i = m.internalPointer() 9 | s = m.internalPointer() 10 | 11 | i = m.constInternalPointer() 12 | s = m.constInternalPointer() -------------------------------------------------------------------------------- /tests/qobject.py: -------------------------------------------------------------------------------- 1 | from typing import List, Iterable, Optional 2 | 3 | from PySide6.QtCore import QObject 4 | from PySide6.QtWidgets import QWidget, QApplication 5 | 6 | if __name__ == '__main__': 7 | app = QApplication([]) 8 | 9 | o1 = QWidget() 10 | w2 = QWidget(o1) 11 | o3 = QObject(o1) 12 | 13 | ### QObject.findChildren() 14 | 15 | a: List[QObject] 16 | a = o1.findChildren(QObject) 17 | assert type(a) == list 18 | assert isinstance(a[0], QObject) 19 | 20 | b: List[QWidget] 21 | b = o1.findChildren(QWidget) 22 | assert type(b) == list 23 | assert isinstance(b[0], QWidget) 24 | 25 | # incorrect here, correctly detected by mypy 26 | c: List[QWidget] 27 | c = o1.findChildren(QObject, '') # type: ignore[arg-type] 28 | 29 | # cast works, List[QWidget] is a List[QObject] 30 | d: List[QObject] 31 | d = o1.findChildren(QWidget, '') 32 | 33 | 34 | ### QObject.findChild() 35 | w3: Optional[QWidget] = None 36 | w3 = o1.findChild(QWidget) 37 | 38 | # incorrect here, correctly detected by mypy 39 | w3 = o1.findChild(QObject) # type: ignore[assignment] 40 | 41 | 42 | ### inherits and other methods 43 | 44 | o1.inherits('toto') 45 | try: 46 | o1.inherits(b'toto') # type: ignore[arg-type] 47 | assert False, 'We expect bytes not to be supported...' 48 | except ValueError: 49 | pass 50 | o1.property('toto') 51 | o1.setProperty('toto', True) 52 | o1.tr('abc', 'def') 53 | -------------------------------------------------------------------------------- /tests/qpainter.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import QLine, QLineF, QPoint, QPointF, QRect, QRectF 2 | from PySide6.QtGui import QPainter, QPaintEvent 3 | from PySide6.QtWidgets import QWidget, QApplication 4 | 5 | if __name__ == '__main__': 6 | app = QApplication([]) 7 | 8 | 9 | class MyWidget(QWidget): 10 | def __init__(self) -> None: 11 | super().__init__() 12 | 13 | def paintEvent(self, e: QPaintEvent) -> None: 14 | painter = QPainter(self) 15 | 16 | painter.beginNativePainting() 17 | painter.drawConvexPolygon([QPoint(0, 0), QPoint(1, 1), QPoint(2, 2)]) 18 | painter.drawConvexPolygon([QPointF(0.0, 0.0), QPointF(1.0, 1.0), QPointF(2.0, 2.0)]) 19 | 20 | painter.drawPolygon([QPoint(0, 0), QPoint(1, 1), QPoint(2, 2)]) 21 | painter.drawPolygon([QPointF(0.0, 0.0), QPointF(1.0, 1.0), QPointF(2.0, 2.0)]) 22 | painter.drawPolyline([QPoint(0, 0), QPoint(1, 1), QPoint(2, 2)]) 23 | painter.drawPolyline([QPointF(0.0, 0.0), QPointF(1.0, 1.0), QPointF(2.0, 2.0)]) 24 | painter.drawRects([QRectF(0.0, 1.0, 2.0, 3.0), QRectF(1.0, 2.0, 3.0, 4.0), QRectF(2.0, 3.0, 4.0, 5.0),]) 25 | painter.drawRects([QRect(0, 1, 2, 3), QRect(1, 2, 3, 4), QRect(2, 3, 4, 5)]) 26 | painter.drawLines([QLineF(0.0, 1.0, 2.0, 3.0), QLineF(1.0, 2.0, 3.0, 4.0), QLineF(2.0, 3.0, 4.0, 5.0),]) 27 | painter.drawLines([QLine(0, 1, 2, 3), QLine(1, 2, 3, 4), QLine(2, 3, 4, 5)]) 28 | painter.drawPoints([QPoint(0, 0), QPoint(1, 1), QPoint(2, 2)]) 29 | painter.drawPoints([QPointF(0.0, 0.0), QPointF(1.0, 1.0), QPointF(2.0, 2.0)]) 30 | painter.end() 31 | -------------------------------------------------------------------------------- /tests/qpixmap.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import Qt 2 | from PySide6.QtGui import QPixmap 3 | 4 | emptyPixmap = QPixmap(16, 16) 5 | emptyPixmap.fill(Qt.GlobalColor.transparent) 6 | emptyPixmap.fill('white') 7 | emptyPixmap.fill(0xFFFFFF) 8 | -------------------------------------------------------------------------------- /tests/qpolygon.py: -------------------------------------------------------------------------------- 1 | from typing import List, Union, Any 2 | 3 | from PySide6.QtGui import QPolygon 4 | from PySide6.QtCore import QPoint 5 | 6 | 7 | point: QPoint 8 | point_list: List[QPoint] 9 | 10 | 11 | point = QPoint() 12 | point_list = [point] 13 | 14 | polygon = QPolygon() # type: QPolygon 15 | polygon << point 16 | polygon << point << point 17 | polygon << [point, point] 18 | polygon << (point, point) 19 | polygon << [point, point] << [point, point] << (point, point) << (point, point) 20 | 21 | assert type(polygon << point) == QPolygon 22 | poly: QPolygon 23 | poly = polygon << point 24 | 25 | assert type(polygon << [point]) == QPolygon 26 | poly = polygon << [point] 27 | 28 | point_list = polygon + [point] 29 | assert type(point_list) == list 30 | assert type(point_list[0]) == QPoint 31 | 32 | 33 | poly_or_pointlist: Union[QPolygon, List[QPoint]] 34 | poly_or_pointlist = [point] 35 | poly_or_pointlist = QPolygon() 36 | 37 | # we can no capture the fact the += changes the type of the result 38 | poly_or_pointlist += [point] # type: ignore[misc] 39 | assert type(poly_or_pointlist) == list 40 | assert type(poly_or_pointlist[0]) == QPoint # type: ignore[index] 41 | 42 | -------------------------------------------------------------------------------- /tests/qprocess.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import QProcess 2 | 3 | v = 33 4 | v = QProcess.ExitStatus.NormalExit.value -------------------------------------------------------------------------------- /tests/qprogressdialog.py: -------------------------------------------------------------------------------- 1 | from typing import Callable 2 | 3 | from PySide6.QtWidgets import QProgressDialog 4 | 5 | qp = QProgressDialog() 6 | qp.setCancelButton(None) 7 | 8 | -------------------------------------------------------------------------------- /tests/qquickitem.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtQuick import QQuickItem 2 | from PySide6.QtCore import Qt 3 | 4 | qi = QQuickItem() 5 | qi.setCursor( Qt.CursorShape.WaitCursor ) 6 | 7 | -------------------------------------------------------------------------------- /tests/qsize.py: -------------------------------------------------------------------------------- 1 | from PySide6 import QtCore 2 | 3 | # QSize tests 4 | qs1 = QtCore.QSize(1, 2) 5 | qs2 = QtCore.QSize(3, 4) 6 | qs3 = QtCore.QSize(5, 6) 7 | 8 | qs3 = qs1 + qs2 9 | assert type(qs3) == QtCore.QSize 10 | qs3 = qs1 - qs2 11 | assert type(qs3) == QtCore.QSize 12 | qs3 += qs1 13 | assert type(qs3) == QtCore.QSize 14 | qs3 -= qs2 15 | assert type(qs3) == QtCore.QSize 16 | 17 | qs3 = qs1 * 3 18 | assert type(qs3) == QtCore.QSize 19 | qs3 = qs1 * 3.0 20 | assert type(qs3) == QtCore.QSize 21 | 22 | qs3 = 3 * qs1 23 | assert type(qs3) == QtCore.QSize 24 | qs3 = 3.0 * qs1 25 | assert type(qs3) == QtCore.QSize 26 | 27 | qs3 = qs1 / 2.0 28 | assert type(qs3) == QtCore.QSize 29 | 30 | qs3 *= 3 31 | assert type(qs3) == QtCore.QSize 32 | qs3 *= 3.0 33 | assert type(qs3) == QtCore.QSize 34 | 35 | qs3 /= 3.0 36 | assert type(qs3) == QtCore.QSize 37 | 38 | 39 | # QSizeF tests 40 | qsf1 = QtCore.QSizeF(1.0, 2.0) 41 | qsf2 = QtCore.QSizeF(3.0, 4.0) 42 | qsf3 = QtCore.QSizeF(5.0, 6.0) 43 | 44 | qsf3 = qsf1 + qsf2 45 | assert type(qsf3) == QtCore.QSizeF 46 | qsf3 = qsf1 - qsf2 47 | assert type(qsf3) == QtCore.QSizeF 48 | qsf3 += qsf1 49 | assert type(qsf3) == QtCore.QSizeF 50 | qsf3 -= qsf2 51 | assert type(qsf3) == QtCore.QSizeF 52 | 53 | qsf3 = qsf1 * 3 54 | assert type(qsf3) == QtCore.QSizeF 55 | qsf3 = qsf1 * 3.0 56 | assert type(qsf3) == QtCore.QSizeF 57 | 58 | qsf3 = 3 * qsf1 59 | assert type(qsf3) == QtCore.QSizeF 60 | qsf3 = 3.0 * qsf1 61 | assert type(qsf3) == QtCore.QSizeF 62 | 63 | qsf3 = qsf1 / 2.0 64 | assert type(qsf3) == QtCore.QSizeF 65 | 66 | qsf3 *= 3 67 | assert type(qsf3) == QtCore.QSizeF 68 | qsf3 *= 3.0 69 | assert type(qsf3) == QtCore.QSizeF 70 | 71 | qsf3 /= 3.0 72 | assert type(qsf3) == QtCore.QSizeF 73 | -------------------------------------------------------------------------------- /tests/qstyleoption.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QStyleOption, QStyle 2 | from PySide6.QtCore import Qt, QRect 3 | from PySide6.QtGui import QFontMetrics, QPalette 4 | 5 | 6 | direction: Qt.LayoutDirection 7 | fontMetrics: QFontMetrics 8 | palette: QPalette 9 | rect: QRect 10 | state: QStyle.StateFlag 11 | t: int 12 | 13 | so = QStyleOption() 14 | direction = so.direction 15 | fontMetrics = so.fontMetrics 16 | palette = so.palette 17 | rect = so.rect 18 | state = so.state 19 | t = so.type 20 | 21 | -------------------------------------------------------------------------------- /tests/qtabbar.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from PySide6.QtWidgets import QTabBar 4 | 5 | tabBar = QTabBar() 6 | tabBar.setTabButton(0, QTabBar.ButtonPosition.LeftSide, None) 7 | 8 | -------------------------------------------------------------------------------- /tests/qtableview.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QTableView 2 | 3 | 4 | v = QTableView() 5 | v.setModel(None) -------------------------------------------------------------------------------- /tests/qtcore_functions.py: -------------------------------------------------------------------------------- 1 | from typing import Callable, Union 2 | 3 | from PySide6.QtCore import qVersion, qWarning, qCritical, qDebug, qFatal, SIGNAL, SLOT, qtTrId 4 | 5 | s = '' # type: str 6 | s = qVersion() 7 | 8 | def check_func_accepts_str_not_bytes(f: Union[Callable[[str], None], Callable[[str], str]]) -> None: 9 | f('toto') 10 | 11 | try: 12 | f(b'toto') # type: ignore[arg-type] 13 | raise AssertionError() 14 | except (ValueError, TypeError): 15 | pass 16 | 17 | 18 | 19 | check_func_accepts_str_not_bytes(qDebug) 20 | check_func_accepts_str_not_bytes(qWarning) 21 | check_func_accepts_str_not_bytes(qCritical) 22 | # check_func_accepts_str_not_bytes(qFatal) 23 | check_func_accepts_str_not_bytes(SIGNAL) 24 | check_func_accepts_str_not_bytes(SLOT) 25 | check_func_accepts_str_not_bytes(qtTrId) 26 | 27 | -------------------------------------------------------------------------------- /tests/qtimer.py: -------------------------------------------------------------------------------- 1 | # from typing_extensions import assert_type 2 | from PySide6.QtCore import QTimer, Signal, SignalInstance 3 | 4 | timout_sig_unbound: Signal = QTimer.timeout 5 | 6 | timer = QTimer() 7 | timeout_sig_bount: SignalInstance = timer.timeout 8 | 9 | timer.timeout.connect(lambda: None) 10 | -------------------------------------------------------------------------------- /tests/qtreeview.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QTreeView 2 | 3 | 4 | v = QTreeView() 5 | v.setModel(None) -------------------------------------------------------------------------------- /tests/qtreewidget.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from PySide6.QtWidgets import QTreeWidget, QTreeWidgetItem 4 | 5 | t = QTreeWidget() 6 | topItem = t.topLevelItem(400) 7 | 8 | item = QTreeWidgetItem(t, ['abc']) 9 | 10 | # it should be possible to remove the item widget for an item 11 | t.setItemWidget(item, 0, None) 12 | 13 | # default type returned by topLevelItem() should allow None value 14 | topItem = None 15 | 16 | -------------------------------------------------------------------------------- /tests/qtreewidgetitem.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QTreeWidgetItem 2 | from PySide6.QtCore import Qt 3 | from PySide6.QtGui import QColor 4 | 5 | 6 | class MyTreeWidgetItem(QTreeWidgetItem): 7 | 8 | # add comparison indicator to allow custom sorting of items 9 | def __lt__(self, other: QTreeWidgetItem) -> bool: 10 | return super().__lt__(other) 11 | 12 | t = QTreeWidgetItem() 13 | 14 | b = True # type: bool 15 | b = t < t 16 | b = t == t 17 | b = t != t 18 | 19 | t.setForeground(3, QColor(Qt.GlobalColor.red)) 20 | t.setBackground(3, QColor(Qt.GlobalColor.red)) 21 | 22 | t.setData(0, 33, 'bla') 23 | t.setData(0, Qt.ItemDataRole.ToolTipRole, 'bla') 24 | 25 | t.data(0, 33) 26 | t.data(0, Qt.ItemDataRole.ToolTipRole) 27 | -------------------------------------------------------------------------------- /tests/qwidget.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtWidgets import QWidget 2 | from PySide6.QtCore import Qt 3 | 4 | w = QWidget() 5 | w.setCursor( Qt.CursorShape.WaitCursor ) 6 | 7 | -------------------------------------------------------------------------------- /tests/qwindow.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtGui import QWindow 2 | from PySide6.QtCore import Qt 3 | 4 | w = QWindow() 5 | w.setCursor( Qt.CursorShape.WaitCursor ) 6 | 7 | -------------------------------------------------------------------------------- /tests/signal_slot.py: -------------------------------------------------------------------------------- 1 | from typing import List, ClassVar, TYPE_CHECKING 2 | 3 | from PySide6.QtCore import Signal, QObject, QMetaObject, SIGNAL, SLOT, Qt, __version__ 4 | from PySide6.QtWidgets import QScrollBar 5 | 6 | 7 | class SomeClassWithSignal(QScrollBar): 8 | signal_no_arg = Signal() # type: ClassVar[Signal] 9 | signal_str = Signal(str) # type: ClassVar[Signal] 10 | signal_int = Signal(int) # type: ClassVar[Signal] 11 | 12 | 13 | def __init__(self) -> None: 14 | super().__init__() # note: this is mandatory for mypy to pickup the class attribute access 15 | self._emitted: List[str] = [] 16 | 17 | def my_slot_no_arg(self) -> None: 18 | print('my_slot_no_arg') 19 | self._emitted.append('my_slot_no_arg') 20 | 21 | def my_slot_str(self, msg: str) -> None: 22 | print(f'my_slot_str({msg})') 23 | self._emitted.append('my_slot_str') 24 | 25 | def my_slot_int(self, value: int) -> None: 26 | print(f'my_slot_int({value})') 27 | self._emitted.append('my_slot_int') 28 | 29 | @property 30 | def emitted(self) -> List[str]: 31 | ret = self._emitted[:] 32 | self._emitted = [] 33 | return ret 34 | 35 | 36 | b: bool 37 | s: str 38 | 39 | s = SIGNAL('valueChanged(int)') 40 | assert type(s) == str 41 | s = SLOT('valueChanged(int)') 42 | assert type(s) == str 43 | 44 | instance = SomeClassWithSignal() 45 | 46 | # Connect using the signal 47 | connection: QMetaObject.Connection 48 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 49 | assert type(connection) == QMetaObject.Connection 50 | 51 | instance.signal_no_arg.emit() 52 | assert instance.emitted == ['my_slot_no_arg'] 53 | 54 | # Disconnect 55 | b = instance.signal_no_arg.disconnect(instance.my_slot_no_arg) 56 | assert type(b) is bool 57 | instance.signal_no_arg.emit() 58 | assert instance.emitted == [] 59 | 60 | # Connect through QObject static method, using SIGNAL()/SLOT() functions 61 | connection = QObject.connect(instance, SIGNAL('valueChanged(int)'), instance, SLOT('my_slot_int(int)'), Qt.ConnectionType.DirectConnection) 62 | try: 63 | connection = QObject.connect(instance, b'valueChanged(int)', instance, b'my_slot_int(int)', Qt.ConnectionType.DirectConnection) # type: ignore[call-overload] 64 | assert False, 'We thought that bytes were not supported' 65 | except ValueError: 66 | pass 67 | assert type(connection) == QMetaObject.Connection 68 | instance.valueChanged.emit(33) 69 | assert instance.emitted == ['my_slot_int'] 70 | 71 | if __version__ < '6.8': 72 | # disconnect 73 | b = instance.valueChanged.disconnect(instance.my_slot_int) 74 | assert type(b) is bool 75 | # pyside 6.8.* has a bug preventing this to work properly 76 | assert b 77 | instance.valueChanged.emit(33) 78 | assert instance.emitted == [] 79 | 80 | instance = SomeClassWithSignal() 81 | 82 | # Connect through QObject static method, using SIGNAL + python functions 83 | connection = QObject.connect(instance, SIGNAL('valueChanged(int)'), instance.my_slot_int, Qt.ConnectionType.DirectConnection) 84 | assert type(connection) == QMetaObject.Connection 85 | instance.valueChanged.emit(33) 86 | assert instance.emitted == ['my_slot_int'] 87 | 88 | # disconnect 89 | if __version__ < '6.8': 90 | b = instance.valueChanged.disconnect(instance.my_slot_int) 91 | assert type(b) is bool 92 | assert b 93 | instance.valueChanged.emit(33) 94 | assert instance.emitted == [] 95 | 96 | instance = SomeClassWithSignal() 97 | 98 | # Connect through QObject instance method, using SIGNAL + python functions 99 | connection = instance.connect(SIGNAL('valueChanged(int)'), instance.my_slot_int, Qt.ConnectionType.DirectConnection) 100 | assert type(connection) == QMetaObject.Connection 101 | instance.valueChanged.emit(33) 102 | assert instance.emitted == ['my_slot_int'] 103 | 104 | # disconnect 105 | b = instance.valueChanged.disconnect(instance.my_slot_int) 106 | assert type(b) is bool 107 | assert b 108 | instance.valueChanged.emit(33) 109 | assert instance.emitted == [] 110 | 111 | # Connect through QObject instance method, to another signal 112 | connection = QObject.connect(instance, SIGNAL('signal_int(int)'), instance, SIGNAL('valueChanged(int)'), Qt.ConnectionType.DirectConnection) 113 | assert type(connection) == QMetaObject.Connection 114 | connection = instance.connect(SIGNAL('valueChanged(int)'), instance.my_slot_int, Qt.ConnectionType.DirectConnection) 115 | assert type(connection) == QMetaObject.Connection 116 | instance.signal_int.emit(33) 117 | assert instance.emitted == ['my_slot_int'] 118 | 119 | # disconnect 120 | b = instance.valueChanged.disconnect(instance.my_slot_int) 121 | assert type(b) is bool 122 | assert b 123 | b = instance.signal_int.disconnect(instance.valueChanged) 124 | assert type(b) is bool 125 | assert b 126 | instance.signal_int.emit(33) 127 | assert instance.emitted == [] 128 | 129 | 130 | # disconnect by signal + function 131 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 132 | b = instance.signal_no_arg.disconnect(instance.my_slot_no_arg) 133 | assert type(b) is bool 134 | assert b 135 | 136 | # disconnect by signal + QMetaObject.Connection 137 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 138 | b = instance.signal_no_arg.disconnect(connection) 139 | assert type(b) is bool 140 | assert b 141 | 142 | # disconnect by instance + SIGNAL() + function 143 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 144 | b = instance.disconnect(SIGNAL('signal_no_arg()'), instance.my_slot_no_arg) 145 | assert type(b) is bool 146 | assert b 147 | 148 | # disconnect by instance + receiver + SLOT() 149 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 150 | b = instance.disconnect(instance, SLOT('my_slot_no_arg()')) 151 | assert type(b) is bool 152 | assert b 153 | 154 | # disconnect by instance + SIGNAL() + receiver + SLOT() 155 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 156 | b = instance.disconnect(SIGNAL('signal_no_arg()'), instance, SLOT('my_slot_no_arg()')) 157 | assert type(b) is bool 158 | assert b 159 | 160 | # disconnect by class + QMetaObject.Connection 161 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 162 | b = SomeClassWithSignal.disconnect(connection) 163 | assert type(b) is bool 164 | assert b 165 | 166 | # disconnect by class + instance + SIGNAL() + function 167 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 168 | b = SomeClassWithSignal.disconnect(instance, SIGNAL('signal_no_arg()'), instance.my_slot_no_arg) 169 | assert type(b) is bool 170 | assert b 171 | 172 | # disconnect by class + instance + SIGNAL() + receiver + SLOT 173 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 174 | b = SomeClassWithSignal.disconnect(instance, SIGNAL('signal_no_arg()'), instance, SLOT('my_slot_no_arg()')) 175 | assert type(b) is bool 176 | assert b 177 | 178 | connection = instance.signal_no_arg.connect(instance.my_slot_no_arg) 179 | r = 33 180 | r = instance.receivers(SIGNAL('signal_no_arg()')) 181 | assert type(r) is int 182 | -------------------------------------------------------------------------------- /tests/slot.py: -------------------------------------------------------------------------------- 1 | 2 | from typing import Callable, TypeVar, Type, overload, Any, TYPE_CHECKING 3 | 4 | from PySide6.QtCore import Slot, QObject 5 | 6 | some_str: str 7 | some_int: int 8 | 9 | class SomeClass1(QObject): 10 | @Slot(int) 11 | def f_int_returns_str1(self, i: int) -> str: 12 | return 'abc' 13 | 14 | sc1 = SomeClass1() 15 | some_str = sc1.f_int_returns_str1(33) 16 | some_int = sc1.f_int_returns_str1(33) # type: ignore[assignment] 17 | some_str = sc1.f_int_returns_str1('abc') # type: ignore[arg-type] 18 | 19 | class SomeClass2(QObject): 20 | @Slot(int, result=str) 21 | def f_int_returns_str2(self, i: int) -> str: 22 | return 'abc' 23 | 24 | sc2 = SomeClass2() 25 | some_str = sc2.f_int_returns_str2(33) 26 | some_int = sc2.f_int_returns_str2(33) # type: ignore[assignment] 27 | 28 | 29 | class SomeClass3(QObject): 30 | @Slot(int, result=int) # type: ignore[arg-type] 31 | def f_int_returns_str3(self, i: int) -> str: 32 | return 'abc' 33 | 34 | @Slot(int, float) 35 | def f_int_float_returns_str1(self, i: int, f: float) -> str: 36 | return 'abc' 37 | 38 | sc3 = SomeClass3() 39 | some_str = sc3.f_int_float_returns_str1(33, 1.0) 40 | some_int = sc3.f_int_float_returns_str1(33, 1.0) # type: ignore[assignment] 41 | some_str = sc3.f_int_float_returns_str1('abc', 1.0) # type: ignore[arg-type] 42 | some_str = sc3.f_int_float_returns_str1(33, 'abc') # type: ignore[arg-type] 43 | 44 | class SomeClass4(QObject): 45 | @Slot(int, float, result=int) # type: ignore[arg-type] 46 | def f_int_float_returns_str2(self, i: int, f: float) -> str: 47 | return 'abc' 48 | 49 | 50 | @Slot(int, float, str) 51 | def f_int_float_str_returns_str1(self, i: int, f: float, s: str) -> str: 52 | return 'abc' 53 | 54 | sc4 = SomeClass4() 55 | some_str = sc4.f_int_float_str_returns_str1(33, 1.0, 'abc') 56 | some_int = sc4.f_int_float_str_returns_str1(33, 1.0, 'abc') # type: ignore[assignment] 57 | some_str = sc4.f_int_float_str_returns_str1('abc', 'abc', 33) # type: ignore[arg-type] 58 | 59 | class SomeClass5(QObject): 60 | @Slot(int, float, str, result=float) # type: ignore[arg-type] 61 | def f_int_float_str_returns_str2(self, i: int, f: float, s: str) -> str: 62 | return 'abc' 63 | 64 | 65 | @Slot(int, float, str, int) 66 | def f_int_float_str_int_returns_str1(self, i: int, f: float, s: str, i2: int) -> str: 67 | return 'abc' 68 | 69 | sc5 = SomeClass5() 70 | some_str = sc5.f_int_float_str_int_returns_str1(33, 1.0, 'abc', 33) 71 | some_int = sc5.f_int_float_str_int_returns_str1(33, 1.0, 'abc', 33) # type: ignore[assignment] 72 | some_str = sc5.f_int_float_str_int_returns_str1(33, 1.0, 'abc', 'abc') # type: ignore[arg-type] 73 | 74 | class SomeClass6(QObject): 75 | @Slot(int, float, str, int, result=float) # type: ignore[arg-type] 76 | def f_int_float_str_int_returns_str2(self, i: int, f: float, s: str, i2: int) -> str: 77 | return 'abc' 78 | 79 | @Slot(int, float, str, float, result=str) # type: ignore[arg-type] 80 | def f_int_float_str_int_returns_str3(self, i: int, f: float, s: str, i2: int) -> str: 81 | return 'abc' 82 | 83 | @Slot(int, float, str, int, bytes) 84 | def f_int_float_str_int_bytes_returns_str1(self, i: int, f: float, s: str, i2: int, b: bytes) -> str: 85 | return 'abc' 86 | 87 | sc6 = SomeClass6() 88 | some_str = sc6.f_int_float_str_int_bytes_returns_str1(33, 1.0, 'abc', 33, b'12') 89 | some_int = sc6.f_int_float_str_int_bytes_returns_str1(33, 1.0, 'abc', 33, b'12') # type: ignore[assignment] 90 | some_str = sc6.f_int_float_str_int_bytes_returns_str1(33, 1.0, 'abc', 33, 'abc') # type: ignore[arg-type] 91 | 92 | class SomeClass7(QObject): 93 | @Slot(int, float, str, int, bytes, result=float) # type: ignore[arg-type] 94 | def f_int_float_str_int_bytes_returns_str2(self, i: int, f: float, s: str, i2: int, b: bytes) -> str: 95 | return 'abc' 96 | 97 | @Slot(int, float, str, float, bytes, result=str) # type: ignore[arg-type] 98 | def f_int_float_str_int_bytes_returns_str3(self, i: int, f: float, s: str, i2: int, b: bytes) -> str: 99 | return 'abc' 100 | 101 | # For 6 arguments, it still works without the result argument 102 | @Slot(int, float, str, int, bytes, float) 103 | def f_int_float_str_int_bytes_float_returns_str(self, i: int, f: float, s: str, i2: int, b1: bytes, f2: float) -> str: 104 | return 'abc' 105 | 106 | 107 | sc7 = SomeClass7() 108 | some_str = sc7.f_int_float_str_int_bytes_float_returns_str(33, 1.0, 'abc', 33, b'12', 1.0) 109 | some_int = sc7.f_int_float_str_int_bytes_float_returns_str(33, 1.0, 'abc', 33, b'12', 1.0) # type: ignore[assignment] 110 | some_str = sc7.f_int_float_str_int_bytes_float_returns_str(33, 1.0, 'abc', 33, 'abc', 'abc') # type: ignore[arg-type] 111 | 112 | class SomeClass8(QObject): 113 | # For 6 arguments, with the result argument, arguments are no longer type-checked. 114 | @Slot(int, float, str, int, bytes, float, result=str) 115 | def f_int_float_str_int_bytes_float_returns_str2(self, s: str) -> str: 116 | return 'abc' 117 | 118 | sc8 = SomeClass8() 119 | # but return value is still type-checked 120 | some_int = sc8.f_int_float_str_int_bytes_float_returns_str2('abc') # type: ignore[assignment] 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /tests/test_examples_here.py: -------------------------------------------------------------------------------- 1 | from typing import Iterator, cast 2 | 3 | import os 4 | from pathlib import Path 5 | 6 | import pytest 7 | from mypy import api 8 | from PySide6.QtWidgets import QApplication 9 | 10 | TESTS_DIR = Path(__file__).parent 11 | 12 | 13 | def gen_file_list() -> Iterator[Path]: 14 | """List of all files included in the directory tests for typing checking them""" 15 | for path in TESTS_DIR.glob("*.py"): 16 | if not path.name.startswith("test_") and not path.name.startswith('X'): 17 | yield path 18 | 19 | 20 | 21 | @pytest.fixture(name="qapplication", scope="session") 22 | def qapplication_fixture() -> QApplication: 23 | application = QApplication.instance() 24 | if application is None: 25 | application = QApplication(['-platform', 'minimal']) 26 | 27 | return cast(QApplication, application) 28 | 29 | @pytest.mark.parametrize( 30 | "filepath", 31 | list(gen_file_list()), 32 | ids=[v.relative_to(TESTS_DIR).as_posix() for v in gen_file_list()], 33 | ) 34 | def test_examples_with_mypy(filepath: Path) -> None: 35 | """Run mypy over example files.""" 36 | stdout, stderr, exitcode = api.run([os.fspath(filepath)] + ['--show-error-codes']) 37 | if stdout: 38 | print(stdout) 39 | if stderr: 40 | print(stderr) 41 | 42 | assert stdout.startswith("Success: no issues found") 43 | assert not stderr 44 | assert exitcode == 0 45 | 46 | 47 | @pytest.mark.parametrize( 48 | "filepath", list(gen_file_list()), ids=[v.name for v in gen_file_list()] 49 | ) 50 | def test_examples_execution(filepath: Path, qapplication: QApplication) -> None: 51 | """Run the test files to make sure they work properly.""" 52 | code = filepath.read_text(encoding="utf-8") 53 | exec(compile(code, filepath, "exec"), {}) 54 | -------------------------------------------------------------------------------- /update_latest_pyside6.py: -------------------------------------------------------------------------------- 1 | """Generate the upstream stubs.""" 2 | import re 3 | import shutil 4 | import subprocess 5 | import sys 6 | import tempfile 7 | import zipfile 8 | import os 9 | from pathlib import Path 10 | from typing import List, Set, Tuple 11 | 12 | # from libcst import MetadataWrapper, parse_module 13 | 14 | from version import PYSIDE6_VERSION, PYSIDE6_VERSION_STR 15 | 16 | BASE_DIR = Path(__file__).parent 17 | PATH_STUBS_PYSIDE6 = BASE_DIR / 'PySide6-stubs' 18 | PATH_STUBS_SHIBOKEN6 = BASE_DIR / 'shiboken6-stubs' 19 | 20 | PLATFORM_WINDOWS = "win_amd64" 21 | PLATFORM_LINUX = "manylinux_2_28_x86_64" 22 | PLATFORM_MACOSX = "macosx_12_0_universal2" 23 | 24 | BRANCH_WINDOWS = 'upstream-pyside6-windows' 25 | BRANCH_LINUX = 'upstream-pyside6-linux' 26 | BRANCH_MACOSX = 'upstream-pyside6-macosx' 27 | 28 | PYSIDE6_ESSENTIALS = "PySide6_Essentials" 29 | PYSIDE6_ADDONS = "PySide6_Addons" 30 | PYSIDE6_SHIBOKEN = "shiboken6" 31 | 32 | def git_current_branch() -> str: 33 | '''Return the current git branch''' 34 | branches = subprocess.check_output(['git', 'branch'], text=True).splitlines() 35 | current_branch = [br for br in branches if br.startswith('* ')][0][2:] 36 | return current_branch 37 | 38 | 39 | def download_stubs(download_folder: Path, platform: str, branch_name: str) -> None: 40 | """Download the stubs and copy them to pyside6-stubs folder.""" 41 | current_branch = git_current_branch() 42 | print(f'Git checkout branch {branch_name}') 43 | subprocess.check_call(['git', 'checkout', branch_name]) 44 | 45 | download_folder = download_folder.absolute() 46 | 47 | download_cmd = [ 48 | sys.executable, 49 | "-m", 50 | "pip", 51 | "download", 52 | "-d", 53 | str(download_folder), 54 | ] 55 | if platform: 56 | download_cmd += [ 57 | "--platform", 58 | platform, 59 | '--no-deps', 60 | ] 61 | for stub_name, target_folder in [ 62 | (PYSIDE6_ESSENTIALS, PATH_STUBS_PYSIDE6), 63 | (PYSIDE6_ADDONS, PATH_STUBS_PYSIDE6), 64 | (PYSIDE6_SHIBOKEN, PATH_STUBS_SHIBOKEN6), 65 | ]: 66 | print(f'Downloading wheel {stub_name} for {platform}') 67 | output = subprocess.run(download_cmd + [ 68 | f"{stub_name}=={'.'.join((str(nbr) for nbr in PYSIDE6_VERSION))}", 69 | ], 70 | env={ 71 | # 'https_proxy' : 'http://xxx.xxx.xxx.xxx:80/', 72 | **os.environ 73 | }, 74 | capture_output=True, 75 | text=True, 76 | check=True, 77 | ).stdout 78 | 79 | mo = re.search(r'^\s*(Saved|File was already downloaded) (.*)\s*$', output, flags=re.MULTILINE) 80 | if not mo: 81 | print(f'Could not find our re in the following output\n<<<\n{output}\n>>>') 82 | sys.exit(-1) 83 | 84 | wheel_fname = mo.group(2) 85 | assert stub_name.lower() in wheel_fname.lower() 86 | assert platform.lower() in wheel_fname.lower() 87 | 88 | # Extract the upstream pyi files 89 | with tempfile.TemporaryDirectory() as temp_folder_str: 90 | temp_folder = Path(temp_folder_str) 91 | print(f"Created temporary directory {temp_folder}") 92 | print(f"Extracting file {wheel_fname}") 93 | with zipfile.ZipFile(wheel_fname, "r") as zip_ref: 94 | zip_ref.extractall(temp_folder) 95 | 96 | target_folder.mkdir(exist_ok=True) 97 | 98 | # Take every pyi file from all folders and move it to "pyside6-stubs" 99 | for folder in temp_folder.glob("*"): 100 | print(f"Scanning folder for pyi files {folder}") 101 | for extracted_file in folder.glob("*.pyi"): 102 | print(f"Copying {extracted_file.name} to {target_folder}") 103 | copy_file = target_folder / extracted_file.name 104 | shutil.copyfile(extracted_file, copy_file) 105 | 106 | # commit new files to branch name 107 | os.chdir(target_folder) 108 | print(f'Git add new files') 109 | subprocess.call(['git', 'add', target_folder]) 110 | 111 | print(f'Git commit new files') 112 | subprocess.call(['git', 'commit', '-m', f'Upgrading upstream to version {PYSIDE6_VERSION_STR}']) 113 | print(f'Commit of new version to {target_folder} done') 114 | print(f'Restoring git branch {current_branch}') 115 | subprocess.check_call(['git', 'checkout', current_branch]) 116 | 117 | 118 | 119 | if __name__ == "__main__": 120 | # Create pyside6-stubs folder if necessary 121 | BASE_DIR.mkdir(exist_ok=True) 122 | 123 | incoming = Path(__file__).parent / 'incoming' 124 | incoming.mkdir(exist_ok=True) 125 | 126 | # Download required packages 127 | #download_stubs(incoming, PLATFORM_WINDOWS, BRANCH_WINDOWS) 128 | #download_stubs(incoming, PLATFORM_LINUX, BRANCH_LINUX) 129 | download_stubs(incoming, PLATFORM_MACOSX, BRANCH_MACOSX) 130 | -------------------------------------------------------------------------------- /version.py: -------------------------------------------------------------------------------- 1 | """Version numbers.""" 2 | PYSIDE6_VERSION=(6, 7, 3) 3 | PYSIDE6_VERSION_STR='.'.join(str(v) for v in PYSIDE6_VERSION) 4 | STUB_VERSION = 0 5 | PYSIDE6_STUB_VERSION = '%d.%d.%d.%d.%d' % (PYSIDE6_VERSION + (STUB_VERSION,)) --------------------------------------------------------------------------------