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