PlotPyStack / PythonQwt

Qt plotting widgets for Python (pure Python reimplementation of Qwt C++ library)
https://pypi.org/project/PythonQwt/
Other
86 stars 25 forks source link

PlotCanvas:QwtStyleSheetRecorder rectList operations throw exceptions #42

Closed ericjmcd closed 4 years ago

ericjmcd commented 8 years ago

For PyQt5 (not using PySide) rectList is declared as a list in the constructor of Border but attempts to call the undefined isEmpty method on it are made in several places. self.rectList = [] not recorder.border.rectList.isEmpty() can be fixed by simply removing the .isEmpty() call as an empty list evaluates as True. not recorder.border.rectList

An append operation is also attempted with the += operator with rects[i] as the argument which evaluates to a QRect object which cannot be used (the += operator requires an iterable object). self.border.rectList += rects[i] can be fixed by making it a normal append call self.border.rectList.append(rects[i])

Another error is generated when trying to create a QRectF and passing a QSize (size) as the 2nd argument instead of a QSizeF `rect = QRectF(QPointF(0., 0.), self.size) can be fixed with rect = QRectF(QPointF(0., 0.), QSizeF(self.__size))`

dlzcn commented 6 years ago

I met similar problem when try to use qdarkstyle from https://github.com/ColinDuquesnoy/QDarkStyleSheet. Following is the traceback

File "C:\devtools\WinPython\py35env\python-3.5.4.amd64\lib\site-packages\qwt\plot_canvas.py", line 64, in drawPath rect = QRectF(QPointF(0., 0.), self.__size) TypeError: arguments did not match any overloaded call: QRectF(): too many arguments QRectF(Union[QPointF, QPoint], QSizeF): argument 2 has unexpected type 'QSize' QRectF(Union[QPointF, QPoint], Union[QPointF, QPoint]): argument 2 has unexpected type 'QSize' QRectF(float, float, float, float): argument 1 has unexpected type 'QPointF' QRectF(QRect): argument 1 has unexpected type 'QPointF' QRectF(QRectF): argument 1 has unexpected type 'QPointF'

To solve the issue not only the codes mentioned here need to be modified, but also following code in fillPixelmap of painter.py

   if widget.testAttribute(Qt.WA_StyledBackground):
       painter.setClipRegion(**QRegion**(rect))
PierreRaybaut commented 4 years ago

Duplicate of #49