QLibraryInfo Class

The QLibraryInfo class provides information about the Qt library. 更多...

头: #include <QLibraryInfo>
CMake: find_package(Qt6 COMPONENTS Core REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

公共类型

enum LibraryPath { PrefixPath, DocumentationPath, HeadersPath, LibrariesPath, LibraryExecutablesPath, …, SettingsPath }

静态公共成员

bool isDebugBuild ()
QString path (QLibraryInfo::LibraryPath p )
QVersionNumber version ()

详细描述

Many pieces of information are established when Qt is configured and built. This class provides an abstraction for accessing that information. By using the static functions of this class, an application can obtain information about the instance of the Qt library which the application is using at run-time.

You can also use a qt.conf file to override the hard-coded paths that are compiled into the Qt library. For more information, see the 使用 qt.conf 文档编制。

另请参阅 QSysInfo and 使用 qt.conf .

成员类型文档编制

enum QLibraryInfo:: LibraryPath

This enum type is used to query for a specific path:

常量 描述
QLibraryInfo::PrefixPath 0 The default prefix for all paths.
QLibraryInfo::DocumentationPath 1 The path to documentation upon install.
QLibraryInfo::HeadersPath 2 The path to all headers.
QLibraryInfo::LibrariesPath 3 The path to installed libraries.
QLibraryInfo::LibraryExecutablesPath 4 The path to installed executables required by libraries at runtime.
QLibraryInfo::BinariesPath 5 The path to installed Qt binaries (tools and applications).
QLibraryInfo::PluginsPath 6 The path to installed Qt plugins.
QLibraryInfo::QmlImportsPath 7 The path to installed QML extensions to import.
QLibraryInfo::Qml2ImportsPath QmlImportsPath The path to installed QML extensions to import.
QLibraryInfo::ArchDataPath 8 The path to general architecture-dependent Qt data.
QLibraryInfo::DataPath 9 The path to general architecture-independent Qt data.
QLibraryInfo::TranslationsPath 10 The path to translation information for Qt strings.
QLibraryInfo::ExamplesPath 11 The path to examples upon install.
QLibraryInfo::TestsPath 12 The path to installed Qt testcases.
QLibraryInfo::SettingsPath 100 The path to Qt settings. Not applicable on Windows.

另请参阅 path ().

成员函数文档编制

[static, since 5.0] bool QLibraryInfo:: isDebugBuild ()

返回 true if this build of Qt was built with debugging enabled, or false if it was built in release mode.

该函数在 Qt 5.0 引入。

[static, since 6.0] QString QLibraryInfo:: path ( QLibraryInfo::LibraryPath p )

Returns the path specified by p .

该函数在 Qt 6.0 引入。

[static, since 5.8] QVersionNumber QLibraryInfo:: version ()

Returns the version of the Qt library.

该函数在 Qt 5.8 引入。

另请参阅 qVersion ().