I have this task that I couldn't solve yet. Working with PyQt and Qt Creator.
I want to embed a custom created widget created in QT Creator into another QMainWindow.
1) Steps I do:
Create a Widget file in QT creator:
2) Save it as *.ui and apply this line to convert it to a *.py file:
pyuic5 gen_settings.ui -o gen_settings.py
3) Open it and see that it starts with
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_gen_settings(object):
def setupUi(self, gen_settings):
gen_settings.setObjectName("gen_settings")
4) Which results in function call of course:
TypeError: arguments did not match any overloaded call:
addWidget(self, QWidget): argument 1 has unexpected type 'function'
when I call it in another QMainWindow file:
class Ui_MainWindow(object):
def setupUi(self, MainWindow, My_Custom_widget):
MainWindow.setObjectName("MainWindow")
self.gridLayout.addWidget(My_Custom_widget, 1, 4, 1, 1)
Any ideas how to solve it?