# Qt

The information in this section applies to Qt 5.5 and later.

Qt is an application development toolkit for C++. Although it is not a distinct programming language, there are special considerations for packaging Qt-based programs and libraries. A small set of tools and conventions has grown out of these considerations.

## Libraries

Packages that provide libraries should be listed in `qt5LibsFun` so that the library is built with each Qt version. A set of packages is provided for each version of Qt; for example, `qt5Libs` always provides libraries built with the latest version, `qt55Libs` provides libraries built with Qt 5.5, and so on. To avoid version conflicts, no top-level attributes are created for these packages.

## Programs

Application packages do not need to be built with every Qt version. To ensure consistency between the package's dependencies, call the package with `qt5Libs.callPackage` instead of the usual `callPackage`. An older version may be selected in case of incompatibility. For example, to build with Qt 5.5, call the package with `qt55Libs.callPackage`.

Several environment variables must be set at runtime for Qt applications to function correctly, including:

- `QT_PLUGIN_PATH`

- `QML_IMPORT_PATH`

- `QML2_IMPORT_PATH`

- `XDG_DATA_DIRS`

To ensure that these are set correctly, the program must be wrapped by invoking `wrapQtProgram program` during installation (for example, during `fixupPhase`). `wrapQtProgram` accepts the same options as `makeWrapper`.

## KDE

Many of the considerations above also apply to KDE packages, especially the need to set the correct environment variables at runtime. To ensure that this is done, invoke `wrapKDEProgram program` during installation. `wrapKDEProgram` also generates a `ksycoca` database so that required data and services can be found. Like its Qt counterpart, `wrapKDEProgram` accepts the same options as `makeWrapper`.