Advice on Qt User interface

Christoph Feck christoph at maxiom.de
Wed Oct 28 03:51:12 GMT 2009


On Tuesday 27 October 2009 22:39:18 Hugo Pereira Da Costa wrote:
> use UI files rather than brute force c++, or indiferent ?

Using Designer UI files rather than handwritten C++ code has some advantages:

+ Obviously, this is WYSIWYG "coding", so you aren't surprised later. You can 
even quickly test with different styles and fonts.

+ Anyone, even non-coders, can make changes to the layout. Think people from 
usability.

+ Generally, "declarative" programming is the way to go, because you can do 
more with the XML than just converting it to a C++ source file.

+ One day KDE might use QtUiTools and load some UI files at run time, so be 
prepared :)

Some disadvantages should not stay unmentioned:

- It may add some bloat (e.g. code created by Designer currently sets object 
names for every layout or spacer, even if you never need a name there)

- Keeping the .ui file and the accessing .cpp in sync may require some more 
care because of the multiple files you have to check.

> I personally hate Qt designer (for my own reasons) and have been used to
> design my UI in brute force c++.

Can you please state your "own reasons"? If there is anything wrong with 
Designer, you can still "hand code" .ui files. Actually, I do this quite often 
myself, especially when doing small changes. Kate has nice XML syntax 
highlighting :)

Christoph Feck (kdepepo)




More information about the kde-core-devel mailing list