Advice on Qt User interface

Parker Coates parker.coates at
Wed Oct 28 13:32:10 GMT 2009

On Tue, Oct 27, 2009 at 23:51, Christoph Feck wrote:
> 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.

I think you can argue this one either way. Sure with Designer you see
the widget layout in real time, but I find specific details are easy
to miss and can lead to surprises later.

For example, not to long ago I had to clean up a rather crufty UI
file. It'd had been edited by a bunch of people over a bunch of years
and needed a clean up. Sure I got to see the layout results, but I was
constantly finding that random widget had random properties set. "Oh,
that widget has wordWrap enabled? Why would it have wordWrap? It only
contains 'Name:'. It should never have to wrap." "What is that widget
doing way over there, now? Oh, there's a spacer there. And that spacer
has an arbitrary minimum width. Why?"

When developing widgets with Designer, one has a tendency to just try
setting different properties until it works. This isn't really that
different from developing widgets in source. The difference is that
with Designer, it's much trickier to remember to clean up failed
experiments and properties that were set unnecessarily. When doing a
widget in C++, it's much easier to see when something is using non
default properties. Because programmers automatically try to do the
most work in as few lines as possible, unnecessary properties are
quickly removed. Using C++ has the advantage of

Of course, Designer is a great tool with a lot of other benefits. No
question there. But I wouldn't argue that it reduces surprises. It's
just that the surprises are of a different kind.


More information about the kde-core-devel mailing list