PlotPyStack / PythonQwt

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

TypeError: 'PySide2.QtCore.QRect' object is not subscriptable #63

Closed fvollmer closed 1 year ago

fvollmer commented 3 years ago

Hi,

I'm using setStyleSheet in my PySide2 application. If I add a QwtPlot I get the following exception:

Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\scale_widget.py", line 406, in paintEvent
    painter.setClipRegion(event.region())
AttributeError: 'PySide2.QtCore.QRect' object has no attribute 'region'
Traceback (most recent call last):
  File "C:\Users\user\project\venv\lib\site-packages\qwt\null_paintdevice.py", line 54, in drawRects
    device.drawRects(rects, rectCount)
  File "C:\Users\user\project\venv\lib\site-packages\qwt\plot_canvas.py", line 75, in drawRects
    self.border.rectList += [rects[i]]
TypeError: 'PySide2.QtCore.QRect' object is not subscriptable

Example code to reproduce the exception

import PySide2.QtWidgets as QtWidgets
import qwt
import sys

class SimplePlot(QtWidgets.QWidget):
    def __init__(self):
        super(SimplePlot, self).__init__()

        self.layout = QtWidgets.QHBoxLayout()
        self.setLayout(self.layout)
        self.plot_widget = qwt.QwtPlot()
        self.plot_widget.setTitle("Really simple demo")
        self.layout.addWidget(self.plot_widget)

        self.setStyleSheet("background-color: red;")

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    foo = SimplePlot()
    foo.show()

    sys.exit(app.exec_())