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