PDA

View Full Version : When QTcreator generates ui_form.h and ... another way to see the code for a .ui ?



tonnot
16th March 2011, 12:45
I have a form at designer, with buttons, and so on.
I'd want to see the code which it would be generated for it.
By the moment I only see a way:
From qtcreator add a QT form class.
Besides I dont know what happens, but the ui_form.h is generated when build.
Is there another way ? I want to see the code generated to use 'by hand'.
Thanks

stampede
16th March 2011, 13:03
In console window:

uic form.ui
will print generated code to stdout
You can for example redirect to file:

uic form.ui > file.h

Octal
16th March 2011, 13:03
You can directly preview the generated code from the designer by Form -> View Code.

a .ui file is just a XML file describing your Interface. It is then converted into valid C++ code by the uic tool.

tonnot
16th March 2011, 13:41
Ok, thank you very much

Zlatomir
16th March 2011, 13:48
You can look at that code, but remember that it's not meant to be modified "by hand".

Also that code it's not meant to be an example on how to add widgets to layouts or else, remember that is a code generated by an computer application meant to be understood by another computer application.

Basically you do the "by hand" stuff in the class that uses (or inherits) from the ui_UiFileName (or Ui::UiFileName) class.