Visual Design With Qt

by Boudewijn Rempt

Related Articles

Qt Attracting Interest Among Application Developers

Boudewijn and Cameron Argue for Qt

A criticism often leveled at Qt (and GTK) is that there isn't a professional visual design tool, like X-designer for Motif, Java or Windows. Of course, developers can tap a multitude of free, open-source visual design tools currently available. Some of these tools have reached great sophistication, like Qt Architect, while others are languishing in the proof-of-concept stage, like viPyl. However, Trolltech AS is on the brink of releasing their long-awaited Qt Designer, a sophisticated, stable, and capable visual design tool, and I've just had the opportunity to play with a pre-release version.

Types of design tools

There are three kinds of visual design tools: tools that generate code, tools that generate a resource file that's interpreted at runtime, and tools that interweave code and design. Qt Designer falls in the first category: the tool generates an XML file which is compiled into C++ code by a separate compiler, uic. An example of the second category is Glade, which produces XML files that libglade reads (Glade can also produce C output). The best example of the third kind of visual design tool is Visual Basic, where you can't separate GUI design and code design.

Each approach has its pros and cons. Generating C++ code means fast applications, but it's not flexible: If the GUI changes, the app must be recompiled. Run-time reading resource files offers all the flexibility you can ask for, but can be very slow. Users tend to expect dialog windows to pop up in less than two seconds! Writing the application code in the same tool you use to design the interface makes for rapid prototyping, but often leads to an incoherent application architecture, with the attendant lack of maintainability.

Design tool characteristics

Visual design tools, whichever kind they might be, sport much the same interface: a palette with widgets, a canvas to place the widgets on, and property sheets to customize the widgets. Beyond that, there are only differences in sophistication. Here are some of the characteristics that help us evaluate these design tools.

  • Can the design tool easily incorporate third-party widgets, or does it only work with the widgets included in the base GUI library?
  • Does the design tool support layout management, or is every widget placed with fixed size and fixed place?
  • Are changes undoable?
  • Can related dialogs be placed in projects?
  • Can the code be generated directly from the designer, or is a separate compiler needed?
  • Can the design tool generate code for more than one language, or is it a single-language tool?
  • Can the tool also be used to create menus and toolbars?
  • How well does the tool handle the special properties of the GUI library?

Moving from the broader set of tools to what's available in the Qt world, let's look at some of the basic characteristics of visual design offerings that predate Trolltech's Qt Designer:

  • Qt Architect
  • QtEZ
  • Ebuilder
  • KDevelop
  • ViPyl
  • XML-builder

Of these options, Qt Architect, by Jeff Harris and Klaus Ebner, is certainly the most mature. It offers good, albeit low-level, layout management support, and it's fairly easy to add home-made widgets to the palette. The most recent version saves its dialogs in an XML format. Qt Architect uses that xml file format only for saving dialogs; when the dialog is finished, it generates C++ code. The XML format is not suited for anything else: It would probably be difficult and certainly very time-consuming to have Qt Architect generate Python instead of C++, or use the XML files as a resource file for a running program. Qt Architect is not entirely stable -- very complex layouts can make the layout editor crash.

QtEZ is another well-developed project. Originally created by Sam Magnusson, it is now maintained by Jan Prokop. QtEZ offers a fairly complete environment for Qt/C++ project development, including generation of makefiles, source code editing, and dialog design. QtEZ also offers support for layout management.

Ebuilder, created by Ernie van der Meer, is said to be approaching version 1.0. I couldn't get it to compile, so I can say little about it.

KDevelop, by Sandy Meier and a team of dedicated developers, is another mature and complete C++ development environment. As a development environment, it's very good, with an excellent class browser, but the included dialog designer is quite primitive, and doesn't support layout management at all.

ViPyl and XML-Builder are interesting in that they try a different approach from source-code generation. ViPyl, by Henning Schroeder, tries to work in the same way as Visual Basic, by offering integrated code and layout design. ViPyl is based on Python, but unfortunately remains in a very early stage. XML-builder, by David W. Schere, uses XML files to generate dialogs run-time. It's Python-based and so old it used the obsolete PythonQt bindings instead of PyQt.

Pages: 1, 2

Next Pagearrow