Using QT to dynamically load UI files is primarily a separation of UI design and software design, and the UI needs to provide the individual control names to programmers. This can be done to meet the late software design, due to customer needs, UI style changeable situation, does not affect the development of programmers.
Concrete implementation: Online data more, generally using quiloader, can only load qwidget or Qframe, the following code is mainly implemented to load the Qwidget window of the child window has some user-defined widgets, here I want to load is Qvtkwidget
QString Uifilepath =
"E:\\task\\ctsoftware\\qtgui\\heartgui.ui";
QString Uidir =
"E:\\task\\ctsoftware\\qtgui";
QString Pluinpath = "%qdir%\\plugins\\designer";
Quiloader UiLoader;
//****************************//
Uiloader.addpluginpath (Pluinpath); To set a custom window widget path
QFile file (Uifilepath);
Const Qdir &workdir (UIDIR);
File.Open (qiodevice::readonly);
Uiloader.setworkingdirectory (Workdir);
UI = Uiloader.load (&file,this);
File.close ();
qt Dynamic Loading UI file (implements some widgets that load custom customizations, such as Qvtkwidget)