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 key19, value13;

} 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

.

相关推荐
用户805533698031 天前
不止三件套:QObject 属性系统全关键字与运行时反射!
c++·qt
xcyxiner1 天前
DicomViewer (vcpkg Windows和ubuntu编译)7
qt
Quz6 天前
QML Hello World 入门示例
qt
xcyxiner9 天前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner10 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner10 天前
DicomViewer (添加模型类)3
qt
xcyxiner11 天前
DicomViewer (目录调整) 2
qt
xcyxiner11 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
桥田智能13 天前
桥田智能 QT-650S:面向白车身焊装的 800kg 重载快换解决方案
开发语言·qt·系统架构
森G13 天前
75、服务器源码解析---------云视频服务项目
linux·服务器·网络·c++·qt