| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the documentation of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:FDL$
|
|---|
| 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 a
|
|---|
| 14 | ** written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 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.
|
|---|
| 21 | **
|
|---|
| 22 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 23 | ** Nokia at qt-info@nokia.com.
|
|---|
| 24 | ** $QT_END_LICENSE$
|
|---|
| 25 | **
|
|---|
| 26 | ****************************************************************************/
|
|---|
| 27 |
|
|---|
| 28 | /*!
|
|---|
| 29 | \page qt-conf.html
|
|---|
| 30 |
|
|---|
| 31 | \title Using qt.conf
|
|---|
| 32 |
|
|---|
| 33 | The \c qt.conf file overrides the hard-coded paths that are
|
|---|
| 34 | compiled into the Qt library. These paths are accessible using the
|
|---|
| 35 | QLibraryInfo class. Without \c qt.conf, the functions in
|
|---|
| 36 | QLibraryInfo return these hard-coded paths; otherwise they return
|
|---|
| 37 | the paths as specified in \c qt.conf.
|
|---|
| 38 |
|
|---|
| 39 | Without \c qt.conf, the Qt libraries will use the hard-coded paths
|
|---|
| 40 | to look for plugins, translations, and so on. These paths may not
|
|---|
| 41 | exist on the target system, or they may not be
|
|---|
| 42 | accesssible. Because of this, you need \c qt.conf to make the Qt
|
|---|
| 43 | libraries look elsewhere.
|
|---|
| 44 |
|
|---|
| 45 | QLibraryInfo will load \c qt.conf from one of the following locations:
|
|---|
| 46 |
|
|---|
| 47 | \list 1
|
|---|
| 48 |
|
|---|
| 49 | \o \c :/qt/etc/qt.conf using the resource system
|
|---|
| 50 |
|
|---|
| 51 | \o on Mac OS X, in the Resource directory inside the appliction
|
|---|
| 52 | bundle, for example \c assistant.app/Contents/Resources/qt.conf
|
|---|
| 53 |
|
|---|
| 54 | \o in the directory containing the application executable, i.e.
|
|---|
| 55 | QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"
|
|---|
| 56 |
|
|---|
| 57 | \o on OS/2, in the directory containing the QtCore dynamic library
|
|---|
| 58 | (only after trying all of the above locations)
|
|---|
| 59 |
|
|---|
| 60 | \endlist
|
|---|
| 61 |
|
|---|
| 62 | The \c qt.conf file is an INI text file, as described in the \l
|
|---|
| 63 | {QSettings::Format}{QSettings} documentation. The file should have
|
|---|
| 64 | a \c Paths group which contains the entries that correspond to
|
|---|
| 65 | each value of the QLibraryInfo::LibraryLocation enum. See the
|
|---|
| 66 | QLibraryInfo documentation for details on the meaning of the
|
|---|
| 67 | various locations.
|
|---|
| 68 |
|
|---|
| 69 | \table
|
|---|
| 70 |
|
|---|
| 71 | \header \o Entry \o Default Value
|
|---|
| 72 |
|
|---|
| 73 | \row \o Prefix \o QCoreApplication::applicationDirPath()
|
|---|
| 74 | \row \o Documentation \o \c doc
|
|---|
| 75 | \row \o Headers \o \c include
|
|---|
| 76 | \row \o Libraries \o \c lib
|
|---|
| 77 | \row \o Binaries \o \c bin
|
|---|
| 78 | \row \o Plugins \o \c plugins
|
|---|
| 79 | \row \o Imports \o \c imports
|
|---|
| 80 | \row \o Data \o \c .
|
|---|
| 81 | \row \o Translations \o \c translations
|
|---|
| 82 | \row \o Settings \o \c .
|
|---|
| 83 | \row \o Examples \o \c .
|
|---|
| 84 | \row \o Demos \o \c .
|
|---|
| 85 |
|
|---|
| 86 | \endtable
|
|---|
| 87 |
|
|---|
| 88 | Absolute paths are used as specified in the \c qt.conf file. All
|
|---|
| 89 | paths are relative to the \c Prefix. On Windows and X11, the \c
|
|---|
| 90 | Prefix is relative to the directory containing the application
|
|---|
| 91 | executable (QCoreApplication::applicationDirPath()). On Mac OS X,
|
|---|
| 92 | the \c Prefix is relative to the \c Contents in the application
|
|---|
| 93 | bundle. For example, \c application.app/Contents/plugins/ is the
|
|---|
| 94 | default location for loading Qt plugins. Note that the plugins
|
|---|
| 95 | need to be placed in specific sub-directories under the
|
|---|
| 96 | \c{plugins} directory (see \l{How to Create Qt Plugins} for
|
|---|
| 97 | details). On OS/2, the \c Prefix is always relative to the directory
|
|---|
| 98 | where \c qt.conf or \c qtsys.conf is loaded from.
|
|---|
| 99 |
|
|---|
| 100 | For example, a \c qt.conf file could contain the following:
|
|---|
| 101 |
|
|---|
| 102 | \snippet doc/src/snippets/code/doc_src_qt-conf.qdoc 0
|
|---|
| 103 |
|
|---|
| 104 | Subgroups of the \c Paths group may be used to specify locations
|
|---|
| 105 | for specific versions of the Qt libraries. Such subgroups are of
|
|---|
| 106 | the form \c Paths/x.y.z, where x is the major version of the Qt
|
|---|
| 107 | libraries, y the minor, and z the patch level. The subgroup that
|
|---|
| 108 | most closely matches the current Qt version is used. If no
|
|---|
| 109 | subgroup matches, the \c Paths group is used as the fallback. The
|
|---|
| 110 | minor and patch level values may be omitted, in which case they
|
|---|
| 111 | default to zero.
|
|---|
| 112 |
|
|---|
| 113 | For example, given the following groups:
|
|---|
| 114 |
|
|---|
| 115 | \snippet doc/src/snippets/code/doc_src_qt-conf.qdoc 1
|
|---|
| 116 |
|
|---|
| 117 | The current version will be matched as shown:
|
|---|
| 118 |
|
|---|
| 119 | \list
|
|---|
| 120 | \o 4.0.1 matches \c Paths/4
|
|---|
| 121 | \o 4.1.5 matches \c Paths/4.1
|
|---|
| 122 | \o 4.6.3 matches \c Paths/4.2.5 (because 4.2.5 is the latest version with the same major version number)
|
|---|
| 123 | \o 5.0.0 matches \c Paths
|
|---|
| 124 | \o 6.0.2 matches \c Paths/6
|
|---|
| 125 | \endlist
|
|---|
| 126 | */
|
|---|