I am using Qt Creator. When I compile an application, are the .ui files turned into compiled code, or are they read and processed at runtime. I ask simply because I am looking at UI performance and if it is loaded at runtime I would imagine there would be some penalty to that?
+2
A:
I believe that you can do either — but if you haven't written any special code to load .ui
files at runtime, it's probably compiled into C++.
icktoofay
2010-06-24 05:01:09
Right; the usual way is for uic to generate C++ code from .ui files, and then for that C++ code to be compiled as usual. But it is also possible to load them at runtime using the QUiLoader class.
Intransigent Parsnip
2010-06-24 05:40:34
Thanks, from Parsnips comment, I am assuming that since I use QtCreator to directly compile into a .exe, then it is getting compiled and not loaded at runtime.
esac
2010-06-24 05:58:33
+3
A:
If you are using QtCreator and not changing anything to your project, the ui file will be used to generate a header file containing the code creating the UI.
For example if your ui file is myform.ui
, the header file generated (with the uic
tool) will be ui_myform.h
.
If you open it, you'll see the code creating your ui.
Jérôme
2010-06-24 06:45:17
I don't necessarily. I see the actual form itself, but all of the widgets I have added to it are not there. There is no code to add the widgets to the form.I see ui->setupUi(this); in the CPP file, but it still does not list each of the individual controls.
esac
2010-06-24 14:52:02