Search code examples
qtqt-designer

Ui forms: Add runtime or compile time?


I want to know which way is efficient if I am having number of UI forms. I don have any idea about memory utilization in both of case I just tried both ways in a simple example.

http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html here they described both ways. Now which one method is more efficient?


Solution

  • The prefered way to use ui files is to compile them with the uic. QtCreator will automatically take care of this. You can use the QUiLoader if you have special constraints - for example if you want to load a customized ui without the need to recompile your program.

    In terms of memory usage you should not notice any difference. Both instanciate the same classes. Of course the time to read/parse/generate code is needed at compile or at runtime. I would say that in a normal application this is rather insignificant since a user interaction is needed to change the form of a application, but I have never benchmarked this.