Important: Please read the Qt Code of Conduct -

Which is more efficient ? use .ui file with QDesigner VS all by code

  • 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 ?
    thank you

  • Moderators

    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.

  • 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.

  • Hi..
    it's actually depends.
    AFAIK ..Both ways are efficient .But through coding developer can have flexibility and less dependency on Designer.

Log in to reply