QSysInfo露

Synopsis露
Static functions露
def
bootUniqueId()def
buildAbi()def
buildCpuArchitecture()def
currentCpuArchitecture()def
kernelType()def
kernelVersion()def
machineHostName()def
machineUniqueId()def
prettyProductName()def
productType()def
productVersion()
Detailed Description露
WordSizespecifies the size of a pointer for the platform on which the application is compiled.
ByteOrderspecifies whether the platform is big-endian or little-endian.Some constants are defined only on certain platforms. You can use the preprocessor symbols
Q_OS_WINandQ_OS_MACOSto test that the application is compiled under Windows or macOS.See also
- class PySide2.QtCore.QSysInfo露
- PySide2.QtCore.QSysInfo.Sizes露
This enum provides platform-specific information about the sizes of data structures used by the underlying architecture.
Constant
Description
QSysInfo.WordSize
The size in bits of a pointer for the platform on which the application is compiled (32 or 64).
- PySide2.QtCore.QSysInfo.Endian露
Constant
Description
QSysInfo.BigEndian
Big-endian byte order (also called Network byte order)
QSysInfo.LittleEndian
Little-endian byte order
QSysInfo.ByteOrder
Equals or , depending on the platform鈥檚 byte order.
- static PySide2.QtCore.QSysInfo.bootUniqueId()露
- Return type:
Returns a unique ID for this machine鈥檚 boot, if one can be determined. If no unique ID could be determined, this function returns an empty byte array. This value is expected to change after every boot and can be considered globally unique.
This function is currently only implemented for Linux and Apple operating systems.
See also
- static PySide2.QtCore.QSysInfo.buildAbi()露
- Return type:
str
Returns the full architecture string that Qt was compiled for. This string is useful for identifying different, incompatible builds. For example, it can be used as an identifier to request an upgrade package from a server.
The values returned from this function are kept stable as follows: the mandatory components of the result will not change in future versions of Qt, but optional suffixes may be added.
The returned value is composed of three or more parts, separated by dashes (鈥-鈥). They are:
Component
Value
CPU Architecture
The same as
buildCpuArchitecture(), such as 鈥渁rm鈥, 鈥渋386鈥, 鈥渕ips鈥 or 鈥渪86_64鈥Endianness
鈥渓ittle_endian鈥 or 鈥渂ig_endian鈥
Word size
Whether it鈥檚 a 32- or 64-bit application. Possible values are: 鈥渓lp64鈥 (Windows 64-bit), 鈥渓p64鈥 (Unix 64-bit), 鈥渋lp32鈥 (32-bit)
(Optional) ABI
Zero or more components identifying different ABIs possible in this architecture. Currently, Qt has optional ABI components for ARM and MIPS processors: one component is the main ABI (such as 鈥渆abi鈥, 鈥渙32鈥, 鈥渘32鈥, 鈥渙64鈥); another is whether the calling convention is using hardware floating point registers (鈥渉ardfloat鈥 is present).
Additionally, if Qt was configured with
-qreal float, the ABI option tag 鈥渜real_float鈥 will be present. If Qt was configured with another type as qreal, that type is present after 鈥渜real_鈥, with all characters other than letters and digits escaped by an underscore, followed by two hex digits. For example,-qreal long doublebecomes 鈥渜real_long_20double鈥.See also
- static PySide2.QtCore.QSysInfo.buildCpuArchitecture()露
- Return type:
str
Returns the architecture of the CPU that Qt was compiled for, in text format. Note that this may not match the actual CPU that the application is running on if there鈥檚 an emulation layer or if the CPU supports multiple architectures (like x86-64 processors supporting i386 applications). To detect that, use
currentCpuArchitecture().Values returned by this function are stable and will not change over time, so applications can rely on the returned value as an identifier, except that new CPU types may be added over time.
Typical returned values are (note: list not exhaustive):
鈥渁rm鈥
鈥渁rm64鈥
鈥渋386鈥
鈥渋a64鈥
鈥渕ips鈥
鈥渕ips64鈥
鈥減ower鈥
鈥減ower64鈥
鈥渟parc鈥
鈥渟parcv9鈥
鈥渪86_64鈥
See also
- static PySide2.QtCore.QSysInfo.currentCpuArchitecture()露
- Return type:
str
Returns the architecture of the CPU that the application is running on, in text format. Note that this function depends on what the OS will report and may not detect the actual CPU architecture if the OS hides that information or is unable to provide it. For example, a 32-bit OS running on a 64-bit CPU is usually unable to determine the CPU is actually capable of running 64-bit programs.
Values returned by this function are mostly stable: an attempt will be made to ensure that they stay constant over time and match the values returned by QSysInfo::builldCpuArchitecture(). However, due to the nature of the operating system functions being used, there may be discrepancies.
Typical returned values are (note: list not exhaustive):
鈥渁rm鈥
鈥渁rm64鈥
鈥渋386鈥
鈥渋a64鈥
鈥渕ips鈥
鈥渕ips64鈥
鈥減ower鈥
鈥減ower64鈥
鈥渟parc鈥
鈥渟parcv9鈥
鈥渪86_64鈥
See also
- static PySide2.QtCore.QSysInfo.kernelType()露
- Return type:
str
Returns the type of the operating system kernel Qt was compiled for. It鈥檚 also the kernel the application is running on, unless the host operating system is running a form of compatibility or virtualization layer.
Values returned by this function are stable and will not change over time, so applications can rely on the returned value as an identifier, except that new OS kernel types may be added over time.
On Windows, this function returns the type of Windows kernel, like 鈥渨innt鈥. On Unix systems, it returns the same as the output of
uname -s(lowercased).Note
This function may return surprising values: it returns 鈥渓inux鈥 for all operating systems running Linux (including Android), 鈥渜nx鈥 for all operating systems running QNX, 鈥渇reebsd鈥 for Debian/kFreeBSD, and 鈥渄arwin鈥 for macOS and iOS. For information on the type of product the application is running on, see
productType().
- static PySide2.QtCore.QSysInfo.kernelVersion()露
- Return type:
str
Returns the release version of the operating system kernel. On Windows, it returns the version of the NT kernel. On Unix systems, including Android and macOS, it returns the same as the
uname -rcommand would return.If the version could not be determined, this function may return an empty string.
- static PySide2.QtCore.QSysInfo.machineHostName()露
- Return type:
str
Returns this machine鈥檚 host name, if one is configured. Note that hostnames are not guaranteed to be globally unique, especially if they were configured automatically.
This function does not guarantee the returned host name is a Fully Qualified Domain Name (FQDN). For that, use
QHostInfoto resolve the returned name to an FQDN.This function returns the same as
localHostName().See also
localDomainNamemachineUniqueId()
- static PySide2.QtCore.QSysInfo.machineUniqueId()露
- Return type:
Returns a unique ID for this machine, if one can be determined. If no unique ID could be determined, this function returns an empty byte array. Unlike
machineHostName(), the value returned by this function is likely globally unique.A unique ID is useful in network operations to identify this machine for an extended period of time, when the IP address could change or if this machine could have more than one IP address. For example, the ID could be used when communicating with a server or when storing device-specific data in shared network storage.
Note that on some systems, this value will persist across reboots and on some it will not. Applications should not blindly depend on this fact without verifying the OS capabilities. In particular, on Linux systems, this ID is usually permanent and it matches the D-Bus machine ID, except for nodes without their own storage (replicated nodes).
See also
- static PySide2.QtCore.QSysInfo.prettyProductName()露
- Return type:
str
Returns a prettier form of
productType()andproductVersion(), containing other tokens like the operating system type, codenames and other information. The result of this function is suitable for displaying to the user, but not for long-term storage, as the string may change with updates to Qt.If
productType()is 鈥渦nknown鈥, this function will instead use thekernelType()andkernelVersion()functions.
- static PySide2.QtCore.QSysInfo.productType()露
- Return type:
str
Returns the product name of the operating system this application is running in. If the application is running on some sort of emulation or virtualization layer (such as WINE on a Unix system), this function will inspect the emulation / virtualization layer.
Values returned by this function are stable and will not change over time, so applications can rely on the returned value as an identifier, except that new OS types may be added over time.
Linux and Android note : this function returns 鈥渁ndroid鈥 for Linux systems running Android userspace, notably when using the Bionic library. For all other Linux systems, regardless of C library being used, it tries to determine the distribution name and returns that. If determining the distribution name failed, it returns 鈥渦nknown鈥.
macOS note : this function returns 鈥渙sx鈥 for all macOS systems, regardless of Apple naming convention. The returned string will be updated for Qt 6. Note that this function erroneously returned 鈥渕acos鈥 for macOS 10.12 in Qt versions 5.6.2, 5.7.1, and 5.8.0.
Darwin, iOS, tvOS, and watchOS note : this function returns 鈥渋os鈥 for iOS systems, 鈥渢vos鈥 for tvOS systems, 鈥渨atchos鈥 for watchOS systems, and 鈥渄arwin鈥 in case the system could not be determined.
FreeBSD note : this function returns 鈥渄ebian鈥 for Debian/kFreeBSD and 鈥渦nknown鈥 otherwise.
Windows note : this function 鈥渨inrt鈥 for WinRT builds, and 鈥渨indows鈥 for normal desktop builds.
For other Unix-type systems, this function usually returns 鈥渦nknown鈥.
- static PySide2.QtCore.QSysInfo.productVersion()露
- Return type:
str
Returns the product version of the operating system in string form. If the version could not be determined, this function returns 鈥渦nknown鈥.
It will return the Android, iOS, macOS, Windows full-product versions on those systems.
Typical returned values are (note: list not exhaustive):
鈥2016.09鈥 (Amazon Linux AMI 2016.09)
鈥7.1鈥 (Android Nougat)
鈥25鈥 (Fedora 25)
鈥10.1鈥 (iOS 10.1)
鈥10.12鈥 (macOS Sierra)
鈥10.0鈥 (tvOS 10)
鈥16.10鈥 (Ubuntu 16.10)
鈥3.1鈥 (watchOS 3.1)
鈥7 SP 1鈥 (Windows 7 Service Pack 1)
鈥8.1鈥 (Windows 8.1)
鈥10鈥 (Windows 10)
鈥淪erver 2016鈥 (Windows Server 2016)
On Linux systems, it will try to determine the distribution version and will return that. This is also done on Debian/kFreeBSD, so this function will return Debian version in that case.
In all other Unix-type systems, this function always returns 鈥渦nknown鈥.
Note
The version string returned from this function is not guaranteed to be orderable. On Linux, the version of the distribution may jump unexpectedly, please refer to the distribution鈥檚 documentation for versioning practices.
漏 2022 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.