1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page fine-tuning-features.html
\title Fine-Tuning Features in Qt
\ingroup qtce
\ingroup qt-embedded-linux
\brief Describes how to reduce the size of Qt libraries by selecting only
the features that are needed.
In many cases, only a fixed set of applications are deployed on an
embedded device, making it possible to save resources by minimizing
the size of the associated libraries. The Qt installation can easily
be optimized by avoiding to compile in the features that are not
required.
\tableofcontents
A wide range of features are defined, covering classes and technologies
provided by several of Qt's modules.
You can look up the different feature definitions in the
\c{src/corelib/global/qfeatures.txt} file within the Qt source
distribution.
\section1 Simple Customization
\section2 Embedded Linux
To disable a particular feature, just run the \c configure script
for Qt for Embedded Linux with the \c -no-feature-<feature> option.
For example:
\snippet doc/src/snippets/code/doc_src_emb-features.qdoc 1
The feature can easily be enabled again by running \c configure
with the \c -feature-<feature> option.
See also \l{Qt Performance Tuning}.
\section2 Windows CE
To disable a particular feature, just run the \c configure script
with the set of required \c -D<feature> options. For example,
you can use the \c -D option to define \c{QT_NO_THREAD}:
\snippet doc/src/snippets/code/doc_src_emb-features.qdoc 0
The \c -D option only creates a Qt internal define. If you get linker
errors you have to define \c QT_NO_THREAD also for your project.
You can do this by adding \c DEFINES += \c QT_NO_THREAD to your
\c .pro file.
See also \l{Qt Performance Tuning}.
\section1 Managing Large Numbers of Features
If you want to disable a lot of features, it is more comfortable
to use the \c qconfig tool.
You can disable a \e set of features by creating a custom
configuration file that defines the preferred subset of Qt's
functionality. Such a file uses macros to disable the unwanted
features, and can be created manually or by using the \c qconfig
tool located in the \c{tools/qconfig} directory of the Qt source
distribution.
\note The \c qconfig tool is intended to be built against Qt on
desktop platforms.
\image qt-embedded-qconfigtool.png
The \c qconfig tool's interface displays all of Qt's
functionality, and allows the user to both disable and enable
features. The user can open and edit any custom configuration file
located in the \c{src/corelib/global} directory. When creating a
custom configuration file manually, a description of the currently
available Qt features can be found in the
\c{src/corelib/global/qfeatures.txt} file.
Note that some features depend on others; disabling any feature
will automatically disable all features depending on it. The
feature dependencies can be explored using the \c qconfig tool,
but they are also described in the \c{src/corelib/global/qfeatures.h}
file.
To be able to apply the custom configuration, it must be saved in
a file called \c qconfig-myfile.h in the \c{src/corelib/global}
directory. Then use the \c configure tool's \c -qconfig option
and pass the configuration's file name without the \c qconfig-
prefix and \c .h extension, as argument.
The following examples show how this is invoked on each of the
embedded platforms for a file called \c{qconfig-myfile.h}:
\bold{Embedded Linux:}
\snippet doc/src/snippets/code/doc_src_emb-features.qdoc 3
\bold{Windows CE:}
\snippet doc/src/snippets/code/doc_src_emb-features.qdoc 2
Qt provides several ready-made custom configuration files,
defining minimal, small, medium and large installations,
respectively. These files are located in the
\c{/src/corelib/global} directory in the Qt source distribution.
*/
|