You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://houndci.com)
9
9
10
-
Qt.py enables you to write software that runs on any of the 6 supported bindings - PySide6, PyQt6, PySide2, PyQt5, PySide and PyQt4.
10
+
Qt.py enables you to write software that runs on any of the 4 supported bindings - PySide6, PyQt6, PySide2, PyQt5.
11
11
12
12
<br>
13
13
@@ -79,7 +79,7 @@ Qt.py enables you to write software that runs on any of the 6 supported bindings
79
79
80
80
Write once, run in any binding.
81
81
82
-
Qt.py was born in the film and visual effects industry to address the growing need for software capable of running with more than one flavor of the Qt bindings for Python - PySide, PySide2, PyQt4 and PyQt5.
82
+
Qt.py was born in the film and visual effects industry to address the growing need for software capable of running with more than one flavor of the Qt bindings for Python - PySide6, PySide2, PyQt6 and PyQt5.
| `loadUi(uifile=str, baseinstance=QWidget)`| `QObject` | Minimal wrapper of PyQt4.loadUi and PySide equivalent
165
+
| `loadUi(uifile=str, baseinstance=QWidget)`| `QObject` | Minimal wrapper of PyQt5.loadUi and PySide equivalent
166
166
| `translate(...)` | `function` | Compatibility wrapper around [QCoreApplication.translate][]
167
167
| `wrapInstance(addr=long, type=QObject)` | `QObject` | Wrapper around `shiboken2.wrapInstance` and PyQt equivalent
168
168
| `getCppPointer(object=QObject)` | `long` | Wrapper around `shiboken2.getCppPointer` and PyQt equivalent
@@ -180,6 +180,8 @@ Qt.py also provides compatibility wrappers for critical functionality that diffe
180
180
181
181
#### Class specific compatibility objects
182
182
183
+
> **Note:** Most of these are for Qt4 and Qt5 compatibility. With 2.0 dropping support for Qt4 many of them are no longer needed, but we are leaving them in for backwards compatibility.
184
+
183
185
Between Qt4 and Qt5 there have been many classes and class members that are obsolete. Under Qt.QtCompat there are many classes with names matching the classes they provide compatibility functions. These will match the PySide2 naming convention.
184
186
185
187
```python
@@ -207,13 +209,15 @@ These are the publicly facing environment variables that in one way or another a
207
209
208
210
##### Subset (or "common members")
209
211
210
-
Members of Qt.py is a subset of PySide2. Which means for a member to be made accessible via Qt.py, it will need to (1) be accessible via PySide2 and (2) each of the other supported bindings. This excludes large portions of the Qt framework, including the newly added QtBluetooth and QtQuick3D modules but guarantees that anything you develop with Qt.py will work identically on any binding - PySide, PySide2, PySide6, PyQt4, PyQt5 and PyQt6. If you need to use such excluded modules with Qt.py, please see [QtSiteConfig.py](#qtsiteconfigpy).
212
+
Members of Qt.py is a subset of PySide6. Which means for a member to be made accessible via Qt.py, it will need to (1) be accessible via PySide6 and (2) each of the other supported bindings. This excludes large portions of the Qt framework, including the newly added QtBluetooth and QtQuick3D modules but guarantees that anything you develop with Qt.py will work identically on any binding - PySide2, PySide6, PyQt5 and PyQt6. If you need to use such excluded modules with Qt.py, please see [QtSiteConfig.py](#qtsiteconfigpy).
211
213
212
214
We call this subset "common members" and these can be generated by running the [tox tests](#running-tests). The membership tests will output all modules and members of each binding into individual JSON files. These JSON files are then compared and a `/.members/common_members.json` file is generated. The contents of the `members` dictionary of this file is copy-pasted into the `_common_members` dictionary of Qt.py. Please note that the script will only use the most up-to-date set of VFX Platform-stipulated software versions.
213
215
214
216
See the wiki for a breakdown of what members are common across the supported Qt python bindings:
-[Qt.py=\=2.0.\*](https://github.com/mottosso/Qt.py/wiki/Membership-between-Qt5.13,Qt6): PySide6, PyQt6, PySide2, PyQt5. (Minimum Qt version 5.13)
220
+
-[Qt.py=\=2.1.\*](https://github.com/mottosso/Qt.py/wiki/Membership-between-Qt5,Qt6): PySide6, PyQt6, PySide2, PyQt5. (Minimum Qt version 5.15)
217
221
218
222
<br>
219
223
@@ -242,8 +246,8 @@ PyQt5
242
246
Constrain available choices and order of discovery by supplying multiple values.
243
247
244
248
```bash
245
-
# Try PyQt4 first and then PySide, but nothing else.
246
-
$ export QT_PREFERRED_BINDING=PyQt4:PySide
249
+
# Try PyQt5 first and then PySide2, but nothing else.
250
+
$ export QT_PREFERRED_BINDING=PyQt5:PySide2
247
251
```
248
252
249
253
Using the OS path separator (`os.pathsep`) which is `:` on Unix systems and `;` on Windows.
@@ -261,9 +265,9 @@ If you need to control the preferred choice of a specific vendored Qt.py you can
261
265
This json data forces any code that uses `import Qt` or `import myproject.vendor.Qt` to use PyQt5(`from x import Qt` etc works too, this is based on `__name__` of the Qt.py being imported). Any other imports of a Qt module will use the "default" PySide2 only. If `"default"` is not provided or a Qt.py being used does not support `QT_PREFERRED_BINDING_JSON`, `QT_PREFERRED_BINDING` will be respected.
262
266
263
267
```bash
264
-
# Try PyQt5 first and then PyQt4 for the Qt module name space.
# Use PySide2 for any other Qt module name spaces.
267
271
$ export QT_PREFERRED_BINDING=PySide2
268
272
```
269
273
@@ -328,7 +332,7 @@ Now you may use the file as you normally would, with Qt.py
328
332
329
333
##### Loading Qt Designer files
330
334
331
-
The `uic.loadUi` function of PyQt4 and PyQt5 as well as the `QtUiTools.QUiLoader().load` function of PySide/PySide2 are mapped to a convenience function `loadUi`.
335
+
The `uic.loadUi` function of PyQt5 and PyQt6 as well as the `QtUiTools.QUiLoader().load` function of PySide6/PySide2 are mapped to a convenience function `loadUi`.
332
336
333
337
```python
334
338
import sys
@@ -364,21 +368,6 @@ Otherwise it will return the newly created instance of the user interface.
364
368
365
369
<br>
366
370
367
-
##### sip API v2
368
-
369
-
If you're using PyQt4, `sip` attempts to set its API to version 2 for the following:
370
-
-`QString`
371
-
-`QVariant`
372
-
-`QDate`
373
-
-`QDateTime`
374
-
-`QTextStream`
375
-
-`QTime`
376
-
-`QUrl`
377
-
378
-
<br>
379
-
<br>
380
-
<br>
381
-
382
371
### Rules
383
372
384
373
The PyQt and PySide bindings are similar, but not identical. Where there is ambiguity, there must to be a clear direction on which path to take.
@@ -530,8 +519,8 @@ Each test is run within it's own isolated process, so as to allow an `import` to
530
519
Tests that are written at module level are run four times - once per binding - whereas tests written under a specific if-statement are run only for this particular binding.
0 commit comments