Hi,
I have the following example, which causes odd behaviour in the displayed chart:
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtWidgets import QApplication
import pyqtgraph as pg
class Broken(QStandardItemModel):
sig = pyqtSignal(QStandardItem)
if __name__ == '__main__':
win = pg.GraphicsWindow()
p1 = win.addPlot(y=[0, 8, 1, 7, 2, 6, 3, 5, 4])
QApplication.instance().exec_()
This is what the chart is supposed to look like:
This is what appears when the signal is defined in the Broken class, and the axes are constantly moving:
It's not that the Broken class is even used anywhere, simply defining the signal has the effect of breaking the chart. If that line is commented out (replaced with pass) then the chart looks fine. Or if QObject is passed as a parameter to pyqtSignal(), it also works fine.
Can anyone help me understand what's wrong? Am I using pyqtSignal incorrectly? Is there something special about QStandardItem? This example is taken from a wider application where we use a lot of signal/slot connections.