Skip to content

Commit 9961a0a

Browse files
committed
Documented why PySide2 support is still experimental
1 parent f604855 commit 9961a0a

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,46 @@ for more details on API limitations when comparing to Qwt.
8181

8282
### Requirements ###
8383
- Python >=2.6 or Python >=3.2
84-
- PyQt4 >=4.4 or PyQt5 >= 5.5
84+
- PyQt4 >=4.4 or PyQt5 >= 5.5 (or PySide2, still experimental, see below)
8585
- QtPy >= 1.3
8686
- NumPy >= 1.5
8787

88+
### Why PySide2 support is still experimental ###
89+
90+
<img src="https://raw.githubusercontent.com/PierreRaybaut/PythonQwt/master/doc/images/pyqt5_vs_pyside2.png">
91+
92+
Try running the `curvebenchmark1.py` test with PyQt5 and PySide: you will notice a
93+
huge performance issue with PySide2 (see screenshot above). This is due to the fact
94+
that PyQt5 (and PyQt4) allows an efficient way of filling a QPolygonF object from a
95+
Numpy array, and PySide2 is not (see function `qwt.plot_curve.series_to_polyline`
96+
below).
97+
98+
```python
99+
def series_to_polyline(xMap, yMap, series, from_, to):
100+
"""
101+
Convert series data to QPolygon(F) polyline
102+
"""
103+
xData = xMap.transform(series.xData()[from_ : to + 1])
104+
yData = yMap.transform(series.yData()[from_ : to + 1])
105+
size = to - from_ + 1
106+
if PYSIDE2:
107+
polyline = QPolygonF()
108+
for index in range(size):
109+
polyline.append(QPointF(xData[index], yData[index]))
110+
else:
111+
polyline = QPolygonF(size)
112+
pointer = polyline.data()
113+
dtype, tinfo = np.float, np.finfo # integers: = np.int, np.iinfo
114+
pointer.setsize(2 * polyline.size() * tinfo(dtype).dtype.itemsize)
115+
memory = np.frombuffer(pointer, dtype)
116+
memory[: (to - from_) * 2 + 1 : 2] = xData
117+
memory[1 : (to - from_) * 2 + 2 : 2] = yData
118+
return polyline
119+
```
120+
121+
As a consequence, until an equivalent feature is implemented in PySide2, we strongly
122+
recommend using PyQt5 instead of PySide2.
123+
88124
## Installation
89125

90126
From the source package:

doc/images/pyqt5_vs_pyside2.png

33.4 KB
Loading

doc/installation.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Dependencies
66

77
Requirements:
88
* Python 2.x (x>=6) or 3.x (x>=2)
9-
* PyQt4 4.x (x>=3 ; recommended x>=4) or PyQt5 5.x (x>=5)
9+
* PyQt4 4.x (x>=4) or PyQt5 5.x (x>=5) or PySide2 (still experimental, see below)
1010
* QtPy >= 1.3
1111
* NumPy 1.x (x>=5)
1212
* Sphinx 1.x (x>=1) for documentation generation
@@ -18,6 +18,22 @@ From the source package:
1818

1919
`python setup.py install`
2020

21+
Why PySide2 support is still experimental
22+
-----------------------------------------
23+
24+
.. image:: /images/pyqt5_vs_pyside2.png
25+
26+
Try running the `curvebenchmark1.py` test with PyQt5 and PySide: you will notice a
27+
huge performance issue with PySide2 (see screenshot above). This is due to the fact
28+
that PyQt5 (and PyQt4) allows an efficient way of filling a QPolygonF object from a
29+
Numpy array, and PySide2 is not (see code below).
30+
31+
.. literalinclude:: /../qwt/plot_curve.py
32+
:pyobject: series_to_polyline
33+
34+
As a consequence, until an equivalent feature is implemented in PySide2, we strongly
35+
recommend using PyQt5 instead of PySide2.
36+
2137
Help and support
2238
----------------
2339

0 commit comments

Comments
 (0)