| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com) | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the documentation of the Qt Toolkit. | 
|---|
| 7 | ** | 
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 9 | ** Commercial Usage | 
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 13 | ** a written agreement between you and Nokia. | 
|---|
| 14 | ** | 
|---|
| 15 | ** GNU Lesser General Public License Usage | 
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 19 | ** packaging of this file.  Please review the following information to | 
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 22 | ** | 
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 26 | ** 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 are unsure which license is appropriate for your use, please | 
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | /*! | 
|---|
| 43 | \page qt-conf.html | 
|---|
| 44 |  | 
|---|
| 45 | \title Using qt.conf | 
|---|
| 46 | \ingroup deployment | 
|---|
| 47 |  | 
|---|
| 48 | The \c qt.conf file overrides the hard-coded paths that are | 
|---|
| 49 | compiled into the Qt library. These paths are accessible using the | 
|---|
| 50 | QLibraryInfo class. Without \c qt.conf, the functions in | 
|---|
| 51 | QLibraryInfo return these hard-coded paths; otherwise they return | 
|---|
| 52 | the paths as specified in \c qt.conf. | 
|---|
| 53 |  | 
|---|
| 54 | Without \c qt.conf, the Qt libraries will use the hard-coded paths | 
|---|
| 55 | to look for plugins, translations, and so on. These paths may not | 
|---|
| 56 | exist on the target system, or they may not be | 
|---|
| 57 | accesssible. Because of this, you need \c qt.conf to make the Qt | 
|---|
| 58 | libraries look elsewhere. | 
|---|
| 59 |  | 
|---|
| 60 | Note that on OS/2, the libraries do not use the hard-coded paths | 
|---|
| 61 | by default. Instead, they look for plugins and other components in a | 
|---|
| 62 | directory that contains the QtCore DLL library (or the application | 
|---|
| 63 | executable if Qt is built as a static library). This behavior may | 
|---|
| 64 | also be overridden using the \c qt.conf file. | 
|---|
| 65 |  | 
|---|
| 66 | QLibraryInfo will load \c qt.conf from one of the following locations: | 
|---|
| 67 |  | 
|---|
| 68 | \list 1 | 
|---|
| 69 |  | 
|---|
| 70 | \o \c :/qt/etc/qt.conf using the resource system | 
|---|
| 71 |  | 
|---|
| 72 | \o on Mac OS X, in the Resource directory inside the appliction | 
|---|
| 73 | bundle, for example \c assistant.app/Contents/Resources/qt.conf | 
|---|
| 74 |  | 
|---|
| 75 | \o in the directory containing the application executable, i.e. | 
|---|
| 76 | QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf" | 
|---|
| 77 |  | 
|---|
| 78 | \endlist | 
|---|
| 79 |  | 
|---|
| 80 | On OS/2, if neither of the above locations contains \c qt.conf, | 
|---|
| 81 | QLibraryInfo will additionally try the following two locations: | 
|---|
| 82 |  | 
|---|
| 83 | \list 1 | 
|---|
| 84 |  | 
|---|
| 85 | \o \c qt.conf in the directory containing the QtCore DLL library | 
|---|
| 86 | (or the application executable if Qt is built as a static library) | 
|---|
| 87 |  | 
|---|
| 88 | \o \c %ETC%\qtsys.conf | 
|---|
| 89 |  | 
|---|
| 90 | \endlist | 
|---|
| 91 |  | 
|---|
| 92 | The \c qt.conf file is an INI text file, as described in the \l | 
|---|
| 93 | {QSettings::Format}{QSettings} documentation. The file should have | 
|---|
| 94 | a \c Paths group which contains the entries that correspond to | 
|---|
| 95 | each value of the QLibraryInfo::LibraryLocation enum. See the | 
|---|
| 96 | QLibraryInfo documentation for details on the meaning of the | 
|---|
| 97 | various locations. | 
|---|
| 98 |  | 
|---|
| 99 | \table | 
|---|
| 100 |  | 
|---|
| 101 | \header \o Entry            \o Default Value | 
|---|
| 102 |  | 
|---|
| 103 | \row \o Prefix              \o QCoreApplication::applicationDirPath() | 
|---|
| 104 | \row \o Documentation       \o \c doc | 
|---|
| 105 | \row \o Headers             \o \c include | 
|---|
| 106 | \row \o Libraries           \o \c lib | 
|---|
| 107 | \row \o Binaries            \o \c bin | 
|---|
| 108 | \row \o Plugins             \o \c plugins | 
|---|
| 109 | \row \o Data                \o \c . | 
|---|
| 110 | \row \o Translations        \o \c translations | 
|---|
| 111 | \row \o Settings            \o \c . | 
|---|
| 112 | \row \o Examples            \o \c . | 
|---|
| 113 | \row \o Demos               \o \c . | 
|---|
| 114 |  | 
|---|
| 115 | \endtable | 
|---|
| 116 |  | 
|---|
| 117 | Absolute paths are used as specified in the \c qt.conf file. All | 
|---|
| 118 | paths are relative to the \c Prefix. On Windows and X11, the \c | 
|---|
| 119 | Prefix is relative to the directory containing the application | 
|---|
| 120 | executable (QCoreApplication::applicationDirPath()). On Mac OS X, | 
|---|
| 121 | the \c Prefix is relative to the \c Contents in the application | 
|---|
| 122 | bundle. For example, \c application.app/Contents/plugins/ is the | 
|---|
| 123 | default location for loading Qt plugins. Note that the plugins | 
|---|
| 124 | need to be placed in specific sub-directories under the | 
|---|
| 125 | \c{plugins} directory (see \l{How to Create Qt Plugins} for | 
|---|
| 126 | details). On OS/2, the \c Prefix is always relative to the directory | 
|---|
| 127 | where \c qt.conf or \c qtsys.conf is loaded from. | 
|---|
| 128 |  | 
|---|
| 129 | For example, a \c qt.conf file could contain the following: | 
|---|
| 130 |  | 
|---|
| 131 | \snippet doc/src/snippets/code/doc_src_qt-conf.qdoc 0 | 
|---|
| 132 |  | 
|---|
| 133 | Subgroups of the \c Paths group may be used to specify locations | 
|---|
| 134 | for specific versions of the Qt libraries. Such subgroups are of | 
|---|
| 135 | the form \c Paths/x.y.z, where x is the major version of the Qt | 
|---|
| 136 | libraries, y the minor, and z the patch level. The subgroup that | 
|---|
| 137 | most closely matches the current Qt version is used. If no | 
|---|
| 138 | subgroup matches, the \c Paths group is used as the fallback. The | 
|---|
| 139 | minor and patch level values may be omitted, in which case they | 
|---|
| 140 | default to zero. | 
|---|
| 141 |  | 
|---|
| 142 | For example, given the following groups: | 
|---|
| 143 |  | 
|---|
| 144 | \snippet doc/src/snippets/code/doc_src_qt-conf.qdoc 1 | 
|---|
| 145 |  | 
|---|
| 146 | The current version will be matched as shown: | 
|---|
| 147 |  | 
|---|
| 148 | \list | 
|---|
| 149 | \o 4.0.1 matches \c Paths/4 | 
|---|
| 150 | \o 4.1.5 matches \c Paths/4.1 | 
|---|
| 151 | \o 4.6.3 matches \c Paths/4.2.5 | 
|---|
| 152 | \o 5.0.0 matches \c Paths | 
|---|
| 153 | \o 6.0.2 matches \c Paths/6 | 
|---|
| 154 | \endlist | 
|---|
| 155 | */ | 
|---|