- Qt 5.5
- Qt Core
- C++ Classes
- QSysInfo
- Qt 5.5.1 Reference Documentation

# QSysInfo Class

The QSysInfo class provides information about the system. More...

Header: | #include <QSysInfo>
qmake: | QT += core

- List of all members, including inherited members

## Public Types

enum | Endian { BigEndian, LittleEndian, ByteOrder }
enum | MacVersion { MV_9, MV_10_0, MV_10_1, MV_10_2, ..., MV_None }
enum | Sizes { WordSize }
enum | WinVersion { WV_32s, WV_95, WV_98, WV_Me, ..., WV_None }

## Static Public Members

const MacVersion | MacintoshVersion
const WinVersion | WindowsVersion
QString | buildAbi()
QString | buildCpuArchitecture()
QString | currentCpuArchitecture()
QString | kernelType()
QString | kernelVersion()
MacVersion | macVersion()
QString | prettyProductName()
QString | productType()
QString | productVersion()
WinVersion | windowsVersion()

## Detailed Description

The QSysInfo class provides information about the system.

- WordSize specifies the size of a pointer for the platform on which the application is compiled.
- ByteOrder specifies whether the platform is big-endian or little-endian.
- WindowsVersion specifies the version of the Windows operating system on which the application is run.
- MacintoshVersion specifies the version of the Macintosh operating system on which the application is run.

Some constants are defined only on certain platforms. You can use the preprocessor symbols Q_OS_WIN and Q_OS_OSX to test that the application is compiled under Windows or OS X.

See also QLibraryInfo.

## Member Type Documentation

### enum QSysInfo::Endian

Constant | Value | Description
--- | --- | ---
`QSysInfo::BigEndian` | `0` | Big-endian byte order (also called Network byte order)
`QSysInfo::LittleEndian` | `1` | Little-endian byte order
`QSysInfo::ByteOrder` | `<platform-dependent>` | Equals BigEndian or LittleEndian, depending on the platform's byte order.

### enum QSysInfo::MacVersion

This enum provides symbolic names for the various versions of the Darwin operating system, covering both OS X and iOS. The QSysInfo::MacintoshVersion variable gives the version of the system on which the application is run.

Constant | Value | Description
--- | --- | ---
`QSysInfo::MV_9` | `0x0001` | Mac OS 9 (unsupported)
`QSysInfo::MV_10_0` | `0x0002` | Mac OS X 10.0 (unsupported)
`QSysInfo::MV_10_1` | `0x0003` | Mac OS X 10.1 (unsupported)
`QSysInfo::MV_10_2` | `0x0004` | Mac OS X 10.2 (unsupported)
`QSysInfo::MV_10_3` | `0x0005` | Mac OS X 10.3 (unsupported)
`QSysInfo::MV_10_4` | `0x0006` | Mac OS X 10.4 (unsupported)
`QSysInfo::MV_10_5` | `0x0007` | Mac OS X 10.5 (unsupported)
`QSysInfo::MV_10_6` | `0x0008` | Mac OS X 10.6
`QSysInfo::MV_10_7` | `0x0009` | Mac OS X 10.7
`QSysInfo::MV_10_8` | `0x000A` | OS X 10.8
`QSysInfo::MV_10_9` | `0x000B` | OS X 10.9
`QSysInfo::MV_10_10` | `0x000C` | OS X 10.10
`QSysInfo::MV_10_11` | `0x000D` | OS X 10.11
`QSysInfo::MV_Unknown` | `0x0000` | An unknown and currently unsupported platform
`QSysInfo::MV_CHEETAH` | `MV_10_0` | Apple codename for MV_10_0
`QSysInfo::MV_PUMA` | `MV_10_1` | Apple codename for MV_10_1
`QSysInfo::MV_JAGUAR` | `MV_10_2` | Apple codename for MV_10_2
`QSysInfo::MV_PANTHER` | `MV_10_3` | Apple codename for MV_10_3
`QSysInfo::MV_TIGER` | `MV_10_4` | Apple codename for MV_10_4
`QSysInfo::MV_LEOPARD` | `MV_10_5` | Apple codename for MV_10_5
`QSysInfo::MV_SNOWLEOPARD` | `MV_10_6` | Apple codename for MV_10_6
`QSysInfo::MV_LION` | `MV_10_7` | Apple codename for MV_10_7
`QSysInfo::MV_MOUNTAINLION` | `MV_10_8` | Apple codename for MV_10_8
`QSysInfo::MV_MAVERICKS` | `MV_10_9` | Apple codename for MV_10_9
`QSysInfo::MV_YOSEMITE` | `MV_10_10` | Apple codename for MV_10_10
`QSysInfo::MV_ELCAPITAN` | `MV_10_11` | Apple codename for MV_10_11
`QSysInfo::MV_IOS` | `1<<8` | iOS (any)
`QSysInfo::MV_IOS_4_3` | ? | iOS 4.3
`QSysInfo::MV_IOS_5_0` | ? | iOS 5.0
`QSysInfo::MV_IOS_5_1` | ? | iOS 5.1
`QSysInfo::MV_IOS_6_0` | ? | iOS 6.0
`QSysInfo::MV_IOS_6_1` | ? | iOS 6.1
`QSysInfo::MV_IOS_7_0` | ? | iOS 7.0
`QSysInfo::MV_IOS_7_1` | ? | iOS 7.1
`QSysInfo::MV_IOS_8_0` | ? | iOS 8.0
`QSysInfo::MV_IOS_8_1` | ? | iOS 8.1
`QSysInfo::MV_IOS_8_2` | ? | iOS 8.2
`QSysInfo::MV_IOS_8_3` | ? | iOS 8.3
`QSysInfo::MV_IOS_8_4` | ? | iOS 8.4
`QSysInfo::MV_IOS_9_0` | ? | iOS 9.0
`QSysInfo::MV_None` | `0xffff` | Not a Darwin operating system

See also WinVersion.

### enum QSysInfo::Sizes

This enum provides platform-specific information about the sizes of data structures used by the underlying architecture.

Constant | Value | Description
--- | --- | ---
`QSysInfo::WordSize` | `( sizeof( void * ) <<3 )` | The size in bits of a pointer for the platform on which the application is compiled (32 or 64).

### enum QSysInfo::WinVersion

This enum provides symbolic names for the various versions of the Windows operating system. On Windows, the QSysInfo::WindowsVersion variable gives the version of the system on which the application is run.

MS-DOS-based versions:

Constant | Value | Description
--- | --- | ---
`QSysInfo::WV_32s` | `0x0001` | Windows 3.1 with Win 32s
`QSysInfo::WV_95` | `0x0002` | Windows 95
`QSysInfo::WV_98` | `0x0003` | Windows 98
`QSysInfo::WV_Me` | `0x0004` | Windows Me

NT-based versions (note that each operating system version is only represented once rather than each Windows edition):

Constant | Value | Description
--- | --- | ---
`QSysInfo::WV_NT` | `0x0010` | Windows NT (operating system version 4.0)
`QSysInfo::WV_2000` | `0x0020` | Windows 2000 (operating system version 5.0)
`QSysInfo::WV_XP` | `0x0030` | Windows XP (operating system version 5.1)
`QSysInfo::WV_2003` | `0x0040` | Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2)
`QSysInfo::WV_VISTA` | `0x0080` | Windows Vista, Windows Server 2008 (operating system version 6.0)
`QSysInfo::WV_WINDOWS7` | `0x0090` | Windows 7, Windows Server 2008 R2 (operating system version 6.1)
`QSysInfo::WV_WINDOWS8` | `0x00a0` | Windows 8 (operating system version 6.2)
`QSysInfo::WV_WINDOWS8_1` | `0x00b0` | Windows 8.1 (operating system version 6.3), introduced in Qt 5.2
`QSysInfo::WV_WINDOWS10` | `0x00c0` | Windows 10 (operating system version 10.0), introduced in Qt 5.5

Alternatively, you may use the following macros which correspond directly to the Windows operating system version number:

Constant | Value | Description
--- | --- | ---
`QSysInfo::WV_4_0` | `WV_NT` | Operating system version 4.0, corresponds to Windows NT
`QSysInfo::WV_5_0` | `WV_2000` | Operating system version 5.0, corresponds to Windows 2000
`QSysInfo::WV_5_1` | `WV_XP` | Operating system version 5.1, corresponds to Windows XP
`QSysInfo::WV_5_2` | `WV_2003` | Operating system version 5.2, corresponds to Windows Server 2003, Windows Server 2003 R2, Windows Home Server, and Windows XP Professional x64 Edition
`QSysInfo::WV_6_0` | `WV_VISTA` | Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008
`QSysInfo::WV_6_1` | `WV_WINDOWS7` | Operating system version 6.1, corresponds to Windows 7 and Windows Server 2008 R2
`QSysInfo::WV_6_2` | `WV_WINDOWS8` | Operating system version 6.2, corresponds to Windows 8
`QSysInfo::WV_6_3` | `WV_WINDOWS8_1` | Operating system version 6.3, corresponds to Windows 8.1, introduced in Qt 5.2
`QSysInfo::WV_10_0` | `WV_WINDOWS10` | Operating system version 10.0, corresponds to Windows 10, introduced in Qt 5.5

CE-based versions:

Constant | Value | Description
--- | --- | ---
`QSysInfo::WV_CE` | `0x0100` | Windows CE
`QSysInfo::WV_CENET` | `0x0200` | Windows CE .NET
`QSysInfo::WV_CE_5` | `0x0300` | Windows CE 5.x
`QSysInfo::WV_CE_6` | `0x0400` | Windows CE 6.x

The following masks can be used for testing whether a Windows version is MS-DOS-based, NT-based, or CE-based:

Constant | Value | Description
--- | --- | ---
`QSysInfo::WV_DOS_based` | `0x000f` | MS-DOS-based version of Windows
`QSysInfo::WV_NT_based` | `0x00f0` | NT-based version of Windows
`QSysInfo::WV_CE_based` | `0x0f00` | CE-based version of Windows
`QSysInfo::WV_None` | `0x0000` | Operating system other than Windows.

See also MacVersion.

## Member Function Documentation

### `[static]` QString QSysInfo::buildAbi()

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 QSysInfo::buildCpuArchitecture(), such as "arm", "i386", "mips" or "x86_64"
Endianness | "little_endian" or "big_endian"
Word size | Whether it's a 32- or 64-bit application. Possible values are: "llp64" (Windows 64-bit), "lp64" (Unix 64-bit), "ilp32" (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 "eabi", "o32", "n32", "o64"); another is whether the calling convention is using hardware floating point registers ("hardfloat" is present).

Additionally, if Qt was configured with `-qreal float`, the ABI option tag "qreal_float" will be present. If Qt was configured with another type as qreal, that type is present after "qreal_", with all characters other than letters and digits escaped by an underscore, followed by two hex digits. For example, `-qreal long double` becomes "qreal_long_20double".

This function was introduced in Qt 5.4.

See also QSysInfo::buildCpuArchitecture().

### `[static]` QString QSysInfo::buildCpuArchitecture()

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's 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):

- "arm"
- "arm64"
- "i386"
- "ia64"
- "mips"
- "mips64"
- "power"
- "power64"
- "sparc"
- "sparcv9"
- "x86_64"

This function was introduced in Qt 5.4.

See also QSysInfo::buildAbi() and QSysInfo::currentCpuArchitecture().

### `[static]` QString QSysInfo::currentCpuArchitecture()

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):

- "arm"
- "arm64"
- "i386"
- "ia64"
- "mips"
- "mips64"
- "power"
- "power64"
- "sparc"
- "sparcv9"
- "x86_64"

This function was introduced in Qt 5.4.

See also QSysInfo::buildAbi() and QSysInfo::buildCpuArchitecture().

### `[static]` QString QSysInfo::kernelType()

Returns the type of the operating system kernel Qt was compiled for. It's 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 "wince" or "winnt". On Unix systems, it returns the same as the output of `uname -s` (lowercased).

Note that this function may return surprising values: it returns "linux" for all operating systems running Linux (including Android), "qnx" for all operating systems running QNX (including BlackBerry 10), "freebsd" for Debian/kFreeBSD, and "darwin" for OS X and iOS. For information on the type of product the application is running on, see productType().

This function was introduced in Qt 5.4.

See also QFileSelector, kernelVersion(), productType(), productVersion(), and prettyProductName().

### `[static]` QString QSysInfo::kernelVersion()

Returns the release version of the operating system kernel. On Windows, it returns the version of the NT or CE kernel. On Unix systems, including Android, BlackBerry and OS X, it returns the same as the `uname -r` command would return.

If the version could not be determined, this function may return an empty string.

This function was introduced in Qt 5.4.

See also kernelType(), productType(), productVersion(), and prettyProductName().

### `[static]` MacVersion QSysInfo::macVersion()

Returns the version of Darwin (OS X or iOS) on which the application is run, or MV_None if the operating system is not a version of Darwin.

### `[static]` QString QSysInfo::prettyProductName()

Returns a prettier form of productType() and productVersion(), 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 "unknown", this function will instead use the kernelType() and kernelVersion() functions.

This function was introduced in Qt 5.4.

See also kernelType(), kernelVersion(), productType(), and productVersion().

### `[static]` QString QSysInfo::productType()

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 "android" 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 "unknown".

BlackBerry note: this function returns "blackberry" for QNX systems running the BlackBerry userspace, but "qnx" for all other QNX-based systems.

Darwin, OS X and iOS note: this function returns "osx" for OS X systems, "ios" for iOS systems and "darwin" in case the system could not be determined.

FreeBSD note: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise.

Windows note: this function returns "winphone" for builds for Windows Phone, "winrt" for WinRT builds, "wince" for Windows CE and Embedded Compact builds, and "windows" for normal desktop builds.

For other Unix-type systems, this function usually returns "unknown".

This function was introduced in Qt 5.4.

See also QFileSelector, kernelType(), kernelVersion(), productVersion(), and prettyProductName().

### `[static]` QString QSysInfo::productVersion()

Returns the product version of the operating system in string form. If the version could not be determined, this function returns "unknown".

It will return the Android, BlackBerry, iOS, OS X, Windows full-product versions on those systems. In particular, on OS X, iOS and Windows, the returned string is similar to the macVersion() or windowsVersion() enums.

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 "unknown".

Note: The version string returned from this function is only guaranteed to be orderable on Android, BlackBerry, OS X and iOS. On Windows, some Windows versions are text ("XP" and "Vista", for example). On Linux, the version of the distribution may jump unexpectedly, please refer to the distribution's documentation for versioning practices.

This function was introduced in Qt 5.4.

See also kernelType(), kernelVersion(), productType(), and prettyProductName().

### `[static]` WinVersion QSysInfo::windowsVersion()

Returns the version of the Windows operating system on which the application is run, or WV_None if the operating system is not Windows.

This function was introduced in Qt 4.4.

## Member Variable Documentation

### const MacVersion QSysInfo::MacintoshVersion

This variable holds the version of the Macintosh operating system on which the application is run.

### const WinVersion QSysInfo::WindowsVersion

This variable holds the version of the Windows operating system on which the application is run.