blob: 8cc463a818a9c3d4a1edc72e2d887393c732cb68 [file] [log] [blame]
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qt-conf.html
\title Using qt.conf
You can use the \c qt.conf file to override paths or to specify arguments
to be passed to the platform plugins.
\section1 Format and Location
The \c qt.conf file is an INI text file, as described in the
\l {QSettings::Format}{QSettings} documentation.
QLibraryInfo will load \c qt.conf from one of the following locations:
\list 1
\li \c :/qt/etc/qt.conf using the resource system
\li on \macos, in the Resource directory inside the application
bundle, for example \c assistant.app/Contents/Resources/qt.conf
\li in the directory containing the application executable, i.e.
QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"
\endlist
\section1 Overriding Paths
The \c qt.conf file can be used to override the hard-coded paths that are
compiled into the Qt library. These paths are accessible using the
QLibraryInfo class. Without \c qt.conf, the functions in
QLibraryInfo return these hard-coded paths; otherwise they return
the paths as specified in \c qt.conf.
Without \c qt.conf, the Qt libraries will use the hard-coded paths
to look for plugins, translations, and so on. These paths may not
exist on the target system, or they may not be
accessible. Because of this, you may need \c qt.conf to make the Qt
libraries look elsewhere.
The file should have
a \c Paths group which contains the entries that correspond to
each value of the QLibraryInfo::LibraryLocation enum. See the
QLibraryInfo documentation for details on the meaning of the
various locations.
\table
\header \li Entry \li Default Value
\row \li Prefix \li QCoreApplication::applicationDirPath()
\row \li Documentation \li \c doc
\row \li Headers \li \c include
\row \li Libraries \li \c lib
\row \li LibraryExecutables \li \c libexec
\row \li Binaries \li \c bin
\row \li Plugins \li \c plugins
\row \li Imports \li \c imports
\row \li Qml2Imports \li \c qml
\row \li ArchData \li \c .
\row \li Data \li \c .
\row \li Translations \li \c translations
\row \li Examples \li \c examples
\row \li Tests \li \c tests
\row \li Settings \li \c .
\endtable
Absolute paths are used as specified in the \c qt.conf file. All
paths are relative to the \c Prefix. On Windows and X11, the \c
Prefix is relative to the directory containing the application
executable (QCoreApplication::applicationDirPath()). On \macos,
the \c Prefix is relative to the \c Contents in the application
bundle. For example, \c application.app/Contents/plugins/ is the
default location for loading Qt plugins. Note that the plugins
need to be placed in specific sub-directories under the
\c{plugins} directory (see \l{How to Create Qt Plugins} for
details).
For example, a \c qt.conf file could contain the following:
\snippet snippets/code/doc_src_qt-conf.qdoc 0
\note The backslash character is treated as a special character
in INI files (see QSettings). It is therefore recommended to
use forward slashes for paths on Windows as well. Otherwise,
an escape character is required:
\code
Prefix = c:\\SomePath
\endcode
\section1 Configuring Arguments to the Platform Plugins
The \c qt.conf may contain a \c Platforms group, whose keys are
comma-delimited lists of arguments to be passed to the platform
plugin. The key name is the name of the platform plugin with the
first letter upper-cased followed by \c Arguments.
For example:
\snippet snippets/code/doc_src_qt-conf.qdoc 1
would cause the Windows platform plugin to use the FreeType font engine.
*/