I'd like to implement a PyQtGraph PlotWidget into a PySide2 application. With PyQt5 everything works. With PySide2 I get the Error shown at the bottom. I already found out, that there's some work in progress, but also it seems that a few people managed to get this working. However, I was not able yet. I am using Pyqtgraph 0.10 and not the developer branch. Shall I change? What do I need to do?
from PySide2.QtWidgets import QApplication, QMainWindow, QGraphicsView, QVBoxLayout, QWidget
import sys
import pyqtgraph as pg
class WdgPlot(QWidget):
def __init__(self, parent=None):
super(WdgPlot, self).__init__(parent)
self.layout = QVBoxLayout(self)
self.pw = pg.PlotWidget(self)
self.pw.plot([1,2,3,4])
self.pw.show()
self.layout.addWidget(self.pw)
self.setLayout(self.layout)
if __name__ == '__main__':
app = QApplication(sys.argv)
w = WdgPlot()
w.show()
sys.exit(app.exec_())
Error:
QtGui.QGraphicsView.__init__(self, parent)
TypeError: arguments did not match any overloaded call:
QGraphicsView(parent: QWidget = None): argument 1 has unexpected type 'WdgPlot'
QGraphicsView(QGraphicsScene, parent: QWidget = None): argument 1 has unexpected type 'WdgPlot'
Traceback (most recent call last):