Inheriting from QWidget pyside 2

I wrote a simple widget that inherits from QWidget like so:


class LineEditBase(QtWidgets.QWidget):
    def __init__(self, label, parent=None, flags = QtCore.Qt.WindowFlags()):
        #QtWidgets.QWidget.__init__(self, parent, flags)
        super(LineEditBase, self).__init__(parent, flags)
        self.label = QtWidgets.QLabel(label)
        self.label.setMinimumSize(80, 20)
        layout = QtWidgets.QHBoxLayout()
        layout.setContentsMargins(0,0,0,0)
        layout.addWidget(self.label)
        self.setLayout(layout)

which gives me an error:

‘PySide2.QtWidgets.QWidget’ called with wrong argument types:
PySide2.QtWidgets.QWidget(int, WindowFlags)
Supported signatures:
PySide2.QtWidgets.QWidget(PySide2.QtWidgets.QWidget = NULL, PySide2.QtCore.Qt.WindowFlags = Qt.WindowFlags()) #

I’m sure this used to work in earlier versions of maya.
I tried not passing flags but no joy. Most likely I’m being silly so please help a fool out!

seb

What are you passing as “parent”? Based on the error message, it is expecting a QWidget or None, but it is getting an int.

As expected I was being stupid … I switched some parameters and all the long though that somehow my none was interpreted as null or 0 becoming an int.

Thanks for the reply!!