You can use the
qt.conf file to override paths or to specify arguments to be passed to the platform plugins.
Format and Location
qt.conf file is an INI text file, as described in the QSettings documentation.
QLibraryInfo will load
qt.conf from one of the following locations:
:/qt/etc/qt.confusing the resource system
- on macOS, in the Resource directory inside the application bundle, for example
- in the directory containing the application executable, i.e. QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"
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
qt.conf, the functions in QLibraryInfo return these hard-coded paths; otherwise they return the paths as specified in
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
qt.conf to make the Qt libraries look elsewhere.
The file should have a
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.
Absolute paths are used as specified in the
qt.conf file. All paths are relative to the
Prefix. On Windows and X11, the
Prefix is relative to the directory containing the application executable (QCoreApplication::applicationDirPath()). On macOS, the
Prefix is relative to the
Contents in the application bundle. For example,
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
plugins directory (see How to Create Qt Plugins for details).
For example, a
qt.conf file could contain the following:
[Paths] Prefix = /some/path Translations = i18n
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:
Prefix = c:\\SomePath
Configuring Arguments to the Platform Plugins
qt.conf may contain a
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
[Platforms] WindowsArguments = fontengine=freetype
would cause the Windows platform plugin to use the FreeType font engine.
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.