qt QLibraryInfo

QLibraryInfo::PrefixPath

0    所有路径的默认前缀
QLibraryInfo::DocumentationPath

1    安装路径中文档位置
QLibraryInfo::HeadersPath

2    头文件位置
QLibraryInfo::LibrariesPath

3    库的安装位置
QLibraryInfo::LibraryExecutablesPath

4    库在运行时所需的已安装可执行文件的位置
QLibraryInfo::BinariesPath

5    Qt二进制文件(工具和应用程序)安装位置
QLibraryInfo::PluginsPath

6    Qt插件位置
QLibraryInfo::ImportsPath

7    QML扩展用于导入的安装位置(QML 1.x)。
QLibraryInfo::Qml2ImportsPath

8    QML扩展用于导入的安装位置(QML 2.x)。
QLibraryInfo::ArchDataPath

9    通用的、和操作系统有关的Qt数据位置
QLibraryInfo::DataPath

10    通用的、和操作系统无关的Qt数据位置
QLibraryInfo::TranslationsPath

11    Qt字符串翻译信息的位置
QLibraryInfo::ExamplesPath

12    位于安装目录下,Qt例子位置。
QLibraryInfo::TestsPath

13    Qt安装目录下测试用例位置
QLibraryInfo::SettingsPath

100    Qt设置位置,在Windows下不起作用,无意义。
 

qt.conf
   2.1.位置及格式
    qt.conf是一个ini格式的文件。QLibraryInfo将会从以下3个位置加载qt.conf文件:

利用Qt的资源系统从资源文件:/qt/etc/qt.conf处加载。
对于macOS,则是位于资源目录下的应用程序簇中。例如:
app/Contents/Resources/qt.conf。
包含应用程序的目录,例如:
 QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf" 

c结构体
 static const struct {
    char key[19], value[13];
} qtConfEntries[] = {
    { "Prefix", "." },
    { "Documentation", "doc" }, // should be ${Data}/doc
    { "Headers", "include" },
    { "Libraries", "lib" },
#ifdef Q_OS_WIN
    { "LibraryExecutables", "bin" },
#else
    { "LibraryExecutables", "libexec" }, // should be ${ArchData}/libexec
#endif
    { "Binaries", "bin" },
    { "Plugins", "plugins" }, // should be ${ArchData}/plugins
    { "Imports", "imports" }, // should be ${ArchData}/imports
    { "Qml2Imports", "qml" }, // should be ${ArchData}/qml
    { "ArchData", "." },
    { "Data", "." },
    { "Translations", "translations" }, // should be ${Data}/translations
    { "Examples", "examples" },
    { "Tests", "tests" },
#ifdef QT_BUILD_QMAKE
    { "Sysroot", "" },
    { "HostBinaries", "bin" },
    { "HostLibraries", "lib" },
    { "HostData", "." },
    { "TargetSpec", "" },
    { "HostSpec", "" },
    { "HostPrefix", "" },
#endif
};

覆盖路径
     qt.conf文件能用来覆盖编译到Qt库中的硬编码路径,也就是1节提到的通过QLibraryInfo::location和QLibraryInfo::LibraryLocation获取到的路径。如果qt.conf中设置了这些路径,则通过QLibraryInfo::location和QLibraryInfo::LibraryLocation获取到的路径将不再是Qt安装时的默认路径,而是qt.conf中设置的这些路径。这在某些情况下会非常有用,如:如果没有qt.conf文件,则Qt库将会用默认硬编码路径去查找插件、翻译文件等路径,这些目录路径在某些目标系统上可能不存在或不能访问,在这种情况下,可以通过在qt.conf文件设置路径,让Qt从qt.conf设置的路径搜索。

      qt.conf文件由路径组构成。每个组对应QLibraryInfo::LibraryLocation枚举即表1中的一个枚举值,如下:

节点    值
Prefix

QCoreApplication::applicationDirPath()

Documentation

doc

Headers

include

Libraries

lib
LibraryExecutables

libexec

Binaries

bin

Plugins

plugins

Imports

imports

Qml2Imports

qml

ArchData

.
Data

.
Translations

translations

Examples

examples

Tests

tests

Settings

.
 

你可能感兴趣的:(qt)