Lets say I have everything that is needed to promote a widget (I will use a QLineEdit in this example) to a class called MyClass. MyClass inherits from QWidget and defines its own functions.
When I promote the QLineEdit to an instance of MyClass, what happens behind the scenes? I know that the QLineEdit is a child of QWidget, so MyClass and QLineEdit are related in that factor. But what happens to the properties? Does the QLineEdit still retain the properties specific to a QLineEdit? How does it just change “types”?
Other than the fact that QLineEdit still retains the properties of QWidget (MyClass inherits from the class), I am unsure what happens behind this promotion of widgets.
When you promote from QLineEdit to MyClass instead if having :
QLineEdit *lineedit=new QLineEdit(centralWidget);You will have:
MyClass * lineedit=new MyClass(centralWidget);And you can call your functions from MyClass in a normal way, you can open the ui.h file and see for yourself.