(I haven’t used Qt for a long time. I was using Qt4 at that time, but it hasn’t changed much)
The UI designer outputs a .ui file. The .ui file will be compiled by uic into ui_WidgetXXOO.h during compilation, which defines a Ui_WidgetXXOO class, which contains all the files added by drag and drop in the designer. The control corresponds to the variable, and then there is a setupUi function, which is used to complete the modifications you make to the control in the designer.
Go back to the WidgetXXOO class, which will contain this ui_WidgetXXOO.h, and then call Ui_WidgetXXOO::setupUi in the constructor with this as the parameter to load the controls you added through the designer and the modifications you made.
How the above UI designer works, you can use Qt Creator to create a default project, and you can see the codes I mentioned above. It is a transparent working process. If you need to write code and modify the control yourself, you only need to write the code you want to add in the constructor of WidgetXXOO, followed by Ui_WidgetXXOO::setupUi.
In Qt development, the UI designer is a very useful tool. Usually, you can use the UI designer by dragging it directly, and then write your own code on this basis to complete the work that cannot be done through the UI designer.
The interface editor actually edits the .ui file. You can directly open the .ui file with a text editor for editing. These dragged controls can be obtained through the UI object, so even the dragged controls can be dynamically controlled by code.
(I haven’t used Qt for a long time. I was using Qt4 at that time, but it hasn’t changed much)
The UI designer outputs a .ui file. The .ui file will be compiled by uic into ui_WidgetXXOO.h during compilation, which defines a Ui_WidgetXXOO class, which contains all the files added by drag and drop in the designer. The control corresponds to the variable, and then there is a setupUi function, which is used to complete the modifications you make to the control in the designer.
Go back to the WidgetXXOO class, which will contain this ui_WidgetXXOO.h, and then call Ui_WidgetXXOO::setupUi in the constructor with this as the parameter to load the controls you added through the designer and the modifications you made.
How the above UI designer works, you can use Qt Creator to create a default project, and you can see the codes I mentioned above. It is a transparent working process. If you need to write code and modify the control yourself, you only need to write the code you want to add in the constructor of WidgetXXOO, followed by Ui_WidgetXXOO::setupUi.
In Qt development, the UI designer is a very useful tool. Usually, you can use the UI designer by dragging it directly, and then write your own code on this basis to complete the work that cannot be done through the UI designer.
The interface editor actually edits the .ui file. You can directly open the .ui file with a text editor for editing. These dragged controls can be obtained through the UI object, so even the dragged controls can be dynamically controlled by code.