I want to add a custom widget I have created in qt designer into my mainwindow. Preferably both mainwindow and widget can be created in qt designer and used as is (.ui file)
Because I couldn't get the widget.ui file working, I tried converting it to python but couldn't get it implemented without various bugs (argument errors, what to use as promoted class name / header file, etc.).
Unfortunately every other guide I found online for creating custom widgets has different structure to the one pyuic5 produces:
pyuic5 result:
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(400, 300)
# Rest of design...
online guide result (pure python):
class PurePythonWidget(QtWidgets.QWidget):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.layout = QtWidgets.QGridLayout()
self.setLayout(self.layout)
# Rest of design...
How can I adapt my code to preferably work with a .ui file or a pyuic5 file. Because almost every approach is slightly different please provide the entire sourcecode too.
In the final product I wan't to use this to fill a Scroll Area with these widgets containing different data. A better approach may resolve this question in a different way.