qt Dynamic Loading UI file (implements some widgets that load custom customizations, such as Qvtkwidget)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.