How to build widgets from any .ui files created by QtDesigner

I would like to make something like GUI creator which takes an ui file and creates widgets in it, and show in a window. So I have created a button on click I use QFileDialog to get a file. And then I would like to use the ui file from QFileDialog to create that gui/widgets and show in a window.

I have tried QFormbuilder, but it always gives me compile error “undefined reference to `QFormBuilder::QFormBuilder()’”

Is there a way to do it in qt5?

Any help appreciated

Answers


From documentation of QUiLoader:

 QUiLoader loader;
 QFile file(":/forms/myform.ui");
 file.open(QFile::ReadOnly);
 QWidget *myWidget = loader.load(&file, this);
 file.close();

I have solved the problem. Actually I was missing QFormbuilder module in my .pro file. So I have just added them, and it is working fine.


Need Your Help

ejabberd on openshift - Failed RPC connection to the node

sed xmpp ejabberd openshift

I am trying to configure ejabberd on DIY cartridge on openshift, following the guide here:

Google Plus Sign-in Button is not rendered & triggered properly

angularjs angularjs-directive google-plus

I need to integrete Google plus sign in button. I'm using angularjs directive (angular-directive.g-signin