Skip to content

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

Description

@fvollmer

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_())

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions