Home > Articles > Programming > C/C++

  • Print
  • + Share This
This chapter is from the book

Customizing Qt/Embedded Linux

When installing Qt/Embedded Linux, we can specify features we want to leave out to reduce its memory footprint. Qt/Embedded Linux includes more than one hundred configurable features, each of which is associated with a preprocessor symbol. For example, QT_NO_FILEDIALOG excludes QFileDialog from the QtGui library, and QT_NO_I18N leaves out all support for internationalization. The features are listed in src/corelib/global/qfeatures.txt.

Qt/Embedded Linux provides five example configurations (minimum, small, medium, large, and dist) that are stored in src/corelib/global/qconfig- xxx .h files. These configurations can be specified using the configure script's -qconfig xxx option, for example:

./configure -qconfig small

To create custom configurations, we can manually provide a qconfig- xxx .h file and use it as though it were a standard configuration. Alternatively, we can use the qconfig graphical tool, located in Qt's tools subdirectory.

Qt/Embedded Linux provides the following classes for interfacing with input and output devices and for customizing the look and feel of the window system:


Base Class for


Screen drivers


Screen driver plugins


Mouse drivers


Mouse driver plugins


Keyboard drivers


Keyboard driver plugins


Input methods


Window decoration styles


Window decoration style plugins

To obtain the list of predefined drivers, input methods, and window decoration styles, run the configure script with the -help option.

The screen driver can be specified using the -display command-line option when starting the Qt/Embedded Linux server, as seen in the previous section, or by setting the QWS_DISPLAY environment variable. The mouse driver and the associated device can be specified using the QWS_MOUSE_PROTO environment variable, whose value must have the syntax type : device , where type is one of the supported drivers and device is the path to the device (e.g., QWS_MOUSE_PROTO=IntelliMouse:/dev/mouse). Keyboards are handled similarly through the QWS_KEYBOARD environment variable. Input methods and window decorations are set programmatically in the server using QWSServer::setCurrentInputMethod() and QApplication::qwsSetDecoration().

Window decoration styles can be set independently of the widget style, which is encapsulated by a QStyle subclass. For example, it is entirely possible to set Windows as the window decoration style and Plastique as the widget style. If desired, decorations can be set on a per-window basis.

The QWSServer class provides various functions for customizing the window system. Applications that run as Qt/Embedded Linux servers can access the unique QWSServer instance through the QWSServer::instance() static function.

Qt/Embedded Linux supports the following font formats: TrueType (TTF), PostScript Type 1, Bitmap Distribution Format (BDF), and Qt Pre-rendered Fonts (QPF).

Because QPF is a raster format, it is designed to be faster and more compact than vector formats such as TTF and Type 1 if we need it only at one or two different sizes. The makeqpf tool can be used to pre-render a TTF or a Type 1 file and save the result in QPF format. An alternative is to run our applications with the -savefonts command-line option.

  • + Share This
  • 🔖 Save To Your Account