Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Which is more efficient ? use .ui file with QDesigner VS all by code
opengpu last edited by
which way is more commom and efficient ?
i normally create my Qt app all by code, and not use .ui & QDesigner at all. and the layout plays an important role here.
Here, i want to know what do u guys usually do ? use .ui & QDesigner is better or not & all by code ?
At runtime, the performance is exactly the same.
Using UI files makes the compilation slightly longer (uic needs to create a header out of .ui file, then C++ compiler needs to compile it), but it's not a big difference.
Using UI files makes the UI implementation much faster than coding everything by hand.
andrep last edited by
I usually do either all in code, or (rarely) do the initial layout in designer and then grab the ui_*.h and "convert" it to "handwritten" code (mostly by throwing out all the unneeded setObjectName, QMetaObject::connectSlotsByName etc calls).
I personally find refactoring code spanning both .ui and .cpp files (like renaming subwidgets, replacing a Foo class subwidget by a similar Bar class, or activities that require subclassing standard widgets to override event handlers or similar) more time consuming in the long run than using a pure .cpp setup.
IamSumit last edited by
it's actually depends.
AFAIK ..Both ways are efficient .But through coding developer can have flexibility and less dependency on Designer.