1<section xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xml:id="sec-language-qt">
4
5<title>Qt</title>
6
7<para>The information in this section applies to Qt 5.5 and later.</para>
8
9<para>Qt is an application development toolkit for C++. Although it is
10not a distinct programming language, there are special considerations
11for packaging Qt-based programs and libraries. A small set of tools
12and conventions has grown out of these considerations.</para>
13
14<section xml:id="ssec-qt-libraries"><title>Libraries</title>
15
16<para>Packages that provide libraries should be listed in
17<varname>qt5LibsFun</varname> so that the library is built with each
18Qt version. A set of packages is provided for each version of Qt; for
19example, <varname>qt5Libs</varname> always provides libraries built
20with the latest version, <varname>qt55Libs</varname> provides
21libraries built with Qt 5.5, and so on. To avoid version conflicts, no
22top-level attributes are created for these packages.</para>
23
24</section>
25
26<section xml:id="ssec-qt-programs"><title>Programs</title>
27
28<para>Application packages do not need to be built with every Qt
29version. To ensure consistency between the package's dependencies,
30call the package with <literal>qt5Libs.callPackage</literal> instead
31of the usual <literal>callPackage</literal>. An older version may be
32selected in case of incompatibility. For example, to build with Qt
335.5, call the package with
34<literal>qt55Libs.callPackage</literal>.</para>
35
36<para>Several environment variables must be set at runtime for Qt
37applications to function correctly, including:</para>
38
39<itemizedlist>
40 <listitem><para><envar>QT_PLUGIN_PATH</envar></para></listitem>
41 <listitem><para><envar>QML_IMPORT_PATH</envar></para></listitem>
42 <listitem><para><envar>QML2_IMPORT_PATH</envar></para></listitem>
43 <listitem><para><envar>XDG_DATA_DIRS</envar></para></listitem>
44</itemizedlist>
45
46<para>To ensure that these are set correctly, the program must be wrapped by
47invoking <literal>wrapQtProgram <replaceable>program</replaceable></literal>
48during installation (for example, during
49<literal>fixupPhase</literal>). <literal>wrapQtProgram</literal>
50accepts the same options as <literal>makeWrapper</literal>.
51</para>
52
53</section>
54
55<section xml:id="ssec-qt-kde"><title>KDE</title>
56
57<para>Many of the considerations above also apply to KDE packages,
58especially the need to set the correct environment variables at
59runtime. To ensure that this is done, invoke <literal>wrapKDEProgram
60<replaceable>program</replaceable></literal> during
61installation. <literal>wrapKDEProgram</literal> also generates a
62<literal>ksycoca</literal> database so that required data and services
63can be found. Like its Qt counterpart,
64<literal>wrapKDEProgram</literal> accepts the same options as
65<literal>makeWrapper</literal>.</para>
66
67</section>
68
69</section>
70