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 qt-conf.html
|
---|
44 |
|
---|
45 | \title Using qt.conf
|
---|
46 |
|
---|
47 | The \c qt.conf file overrides the hard-coded paths that are
|
---|
48 | compiled into the Qt library. These paths are accessible using the
|
---|
49 | QLibraryInfo class. Without \c qt.conf, the functions in
|
---|
50 | QLibraryInfo return these hard-coded paths; otherwise they return
|
---|
51 | the paths as specified in \c qt.conf.
|
---|
52 |
|
---|
53 | Without \c qt.conf, the Qt libraries will use the hard-coded paths
|
---|
54 | to look for plugins, translations, and so on. These paths may not
|
---|
55 | exist on the target system, or they may not be
|
---|
56 | accesssible. Because of this, you need \c qt.conf to make the Qt
|
---|
57 | libraries look elsewhere.
|
---|
58 |
|
---|
59 | Note that on OS/2, the libraries do not use the hard-coded paths
|
---|
60 | by default. Instead, they look for plugins and other components in a
|
---|
61 | directory that contains the QtCore DLL library (or the application
|
---|
62 | executable if Qt is built as a static library). This behavior may
|
---|
63 | also be overridden using the \c qt.conf file.
|
---|
64 |
|
---|
65 | QLibraryInfo will load \c qt.conf from one of the following locations:
|
---|
66 |
|
---|
67 | \list 1
|
---|
68 |
|
---|
69 | \o \c :/qt/etc/qt.conf using the resource system
|
---|
70 |
|
---|
71 | \o on Mac OS X, in the Resource directory inside the appliction
|
---|
72 | bundle, for example \c assistant.app/Contents/Resources/qt.conf
|
---|
73 |
|
---|
74 | \o in the directory containing the application executable, i.e.
|
---|
75 | QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"
|
---|
76 |
|
---|
77 | \endlist
|
---|
78 |
|
---|
79 | On OS/2, if neither of the above locations contains \c qt.conf,
|
---|
80 | QLibraryInfo will additionally try the following locations, in the
|
---|
81 | given order:
|
---|
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 hard-coded system-wide \c .conf file (if set by the given build
|
---|
89 | of the Qt library)
|
---|
90 |
|
---|
91 | \o \c %ETC%\qt.conf
|
---|
92 |
|
---|
93 | \endlist
|
---|
94 |
|
---|
95 | The \c qt.conf file is an INI text file, as described in the \l
|
---|
96 | {QSettings::Format}{QSettings} documentation. The file should have
|
---|
97 | a \c Paths group which contains the entries that correspond to
|
---|
98 | each value of the QLibraryInfo::LibraryLocation enum. See the
|
---|
99 | QLibraryInfo documentation for details on the meaning of the
|
---|
100 | various locations.
|
---|
101 |
|
---|
102 | \table
|
---|
103 |
|
---|
104 | \header \o Entry \o Default Value
|
---|
105 |
|
---|
106 | \row \o Prefix \o QCoreApplication::applicationDirPath()
|
---|
107 | \row \o Documentation \o \c doc
|
---|
108 | \row \o Headers \o \c include
|
---|
109 | \row \o Libraries \o \c lib
|
---|
110 | \row \o Binaries \o \c bin
|
---|
111 | \row \o Plugins \o \c plugins
|
---|
112 | \row \o Data \o \c .
|
---|
113 | \row \o Translations \o \c translations
|
---|
114 | \row \o Settings \o \c .
|
---|
115 | \row \o Examples \o \c .
|
---|
116 | \row \o Demos \o \c .
|
---|
117 |
|
---|
118 | \endtable
|
---|
119 |
|
---|
120 | Absolute paths are used as specified in the \c qt.conf file. All
|
---|
121 | paths are relative to the \c Prefix. On Windows and X11, the \c
|
---|
122 | Prefix is relative to the directory containing the application
|
---|
123 | executable (QCoreApplication::applicationDirPath()). On Mac OS X,
|
---|
124 | the \c Prefix is relative to the \c Contents in the application
|
---|
125 | bundle. For example, \c application.app/Contents/plugins/ is the
|
---|
126 | default location for loading Qt plugins. Note that the plugins
|
---|
127 | need to be placed in specific sub-directories under the
|
---|
128 | \c{plugins} directory (see \l{How to Create Qt Plugins} for
|
---|
129 | details). On OS/2, the \c Prefix is always relative to the directory
|
---|
130 | where \c qt.conf or \c qtsys.conf is loaded from.
|
---|
131 |
|
---|
132 | For example, a \c qt.conf file could contain the following:
|
---|
133 |
|
---|
134 | \snippet doc/src/snippets/code/doc_src_qt-conf.qdoc 0
|
---|
135 |
|
---|
136 | Subgroups of the \c Paths group may be used to specify locations
|
---|
137 | for specific versions of the Qt libraries. Such subgroups are of
|
---|
138 | the form \c Paths/x.y.z, where x is the major version of the Qt
|
---|
139 | libraries, y the minor, and z the patch level. The subgroup that
|
---|
140 | most closely matches the current Qt version is used. If no
|
---|
141 | subgroup matches, the \c Paths group is used as the fallback. The
|
---|
142 | minor and patch level values may be omitted, in which case they
|
---|
143 | default to zero.
|
---|
144 |
|
---|
145 | For example, given the following groups:
|
---|
146 |
|
---|
147 | \snippet doc/src/snippets/code/doc_src_qt-conf.qdoc 1
|
---|
148 |
|
---|
149 | The current version will be matched as shown:
|
---|
|
---|