Skip to content

Commit afe5d1d

Browse files
committed
WIP: README.md updates
1 parent d1c3fef commit afe5d1d

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

README.md

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Qt-py/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
88
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
99

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.
1111

1212
<br>
1313

@@ -79,7 +79,7 @@ Qt.py enables you to write software that runs on any of the 6 supported bindings
7979

8080
Write once, run in any binding.
8181

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.
8383

8484
| Goal | Description
8585
|:-------------------------------------|:---------------
@@ -162,7 +162,7 @@ Qt.py also provides compatibility wrappers for critical functionality that diffe
162162

163163
| Attribute | Returns | Description
164164
|:------------------------------------------|:------------|:------------
165-
| `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
166166
| `translate(...)` | `function` | Compatibility wrapper around [QCoreApplication.translate][]
167167
| `wrapInstance(addr=long, type=QObject)` | `QObject` | Wrapper around `shiboken2.wrapInstance` and PyQt equivalent
168168
| `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
180180

181181
#### Class specific compatibility objects
182182

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+
183185
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.
184186

185187
```python
@@ -207,13 +209,15 @@ These are the publicly facing environment variables that in one way or another a
207209

208210
##### Subset (or "common members")
209211

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).
211213

212214
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.
213215

214216
See the wiki for a breakdown of what members are common across the supported Qt python bindings:
215217
- [Qt.py<1.4](https://github.com/mottosso/Qt.py/wiki/Membership-between-Qt4,Qt5): PySide2, PyQt5, PySide, PyQt4
216218
- [Qt.py=\=1.4.\*](https://github.com/mottosso/Qt.py/wiki/Membership-between-Qt4,Qt5,Qt6): PySide6, PyQt6, PySide2, PyQt5, PySide, PyQt4
219+
- [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)
217221

218222
<br>
219223

@@ -242,8 +246,8 @@ PyQt5
242246
Constrain available choices and order of discovery by supplying multiple values.
243247

244248
```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
247251
```
248252

249253
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
261265
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.
262266

263267
```bash
264-
# Try PyQt5 first and then PyQt4 for the Qt module name space.
265-
$ export QT_PREFERRED_BINDING_JSON="{"Qt":["PyQt5","PyQt4"]}"
266-
# Use PyQt4 for any other Qt module name spaces.
268+
# Try PyQt6 first and then PyQt5 for the Qt module name space.
269+
$ export QT_PREFERRED_BINDING_JSON="{"Qt":["PyQt6","PyQt5"]}"
270+
# Use PySide2 for any other Qt module name spaces.
267271
$ export QT_PREFERRED_BINDING=PySide2
268272
```
269273

@@ -328,7 +332,7 @@ Now you may use the file as you normally would, with Qt.py
328332

329333
##### Loading Qt Designer files
330334

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`.
332336

333337
```python
334338
import sys
@@ -364,21 +368,6 @@ Otherwise it will return the newly created instance of the user interface.
364368

365369
<br>
366370

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-
382371
### Rules
383372

384373
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
530519
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.
531520

532521
```python
533-
if binding("PyQt4"):
534-
def test_something_related_to_pyqt4():
522+
if binding("PyQt5"):
523+
def test_something_related_to_pyqt5():
535524
pass
536525
```
537526

0 commit comments

Comments
 (0)