@@ -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
90126From the source package:
0 commit comments