QOperatingSystemVersion#

The QOperatingSystemVersion class provides information about the operating system version. More

Inheritance diagram of PySide6.QtCore.QOperatingSystemVersion

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

Unlike other version functions in QSysInfo , QOperatingSystemVersion provides access to the full version number that developers typically use to vary behavior or determine whether to enable APIs or features based on the operating system version (as opposed to the kernel version number or marketing version).

Presently, Android, Apple Platforms (iOS, macOS, tvOS, and watchOS), and Windows are supported.

The majorVersion(), minorVersion(), and microVersion() functions return the parts of the operating system version number based on:

Platforms

Value

Android

result of parsing android.os.Build.VERSION.RELEASE using QVersionNumber , with a fallback to android.os.Build.VERSION.SDK_INT to determine the major and minor version component if the former fails

Apple Platforms

majorVersion , minorVersion , and patchVersion from NSProcessInfo.operatingSystemVersion

Windows

dwMajorVersion, dwMinorVersion, and dwBuildNumber from RtlGetVersion - note that this function ALWAYS return the version number of the underlying operating system, as opposed to the shim underneath GetVersionEx that hides the real version number if the application is not manifested for that version of the OS

Because QOperatingSystemVersion stores both a version number and an OS type, the OS type can be taken into account when performing comparisons. For example, on a macOS system running macOS Sierra (v10.12), the following expression will return false even though the major version number component of the object on the left hand side of the expression (10) is greater than that of the object on the right (9):

QOperatingSystemVersion.current() >= QOperatingSystemVersion(QOperatingSystemVersion.IOS, 9)

This allows expressions for multiple operating systems to be joined with a logical OR operator and still work as expected. For example:

current = QOperatingSystemVersion.current()
if (current >= QOperatingSystemVersion.OSXYosemite or
    current >= QOperatingSystemVersion(QOperatingSystemVersion.IOS, 8)) {
    # returns true on macOS >= 10.10 and iOS >= 8.0, but false on macOS < 10.10 and iOS < 8.0

A more naive comparison algorithm might incorrectly return true on all versions of macOS, including Mac OS 9. This behavior is achieved by overloading the comparison operators to return false whenever the OS types of the QOperatingSystemVersion instances being compared do not match. Be aware that due to this it can be the case x >= y and x < y are BOTH false for the same instances of x and y.

class PySide6.QtCore.QOperatingSystemVersion(osType, vmajor[, vminor=-1[, vmicro=-1]])#
Parameters:
  • vmicro – int

  • vmajor – int

  • osTypeOSType

  • vminor – int

Constructs a QOperatingSystemVersion consisting of the OS type osType, and major, minor, and micro version numbers vmajor, vminor and vmicro, respectively.

PySide6.QtCore.QOperatingSystemVersion.OSType#

This enum provides symbolic names for the various operating system families supported by QOperatingSystemVersion .

Constant

Description

QOperatingSystemVersion.Android

The Google Android operating system.

QOperatingSystemVersion.IOS

The Apple iOS operating system.

QOperatingSystemVersion.MacOS

The Apple macOS operating system.

QOperatingSystemVersion.TvOS

The Apple tvOS operating system.

QOperatingSystemVersion.WatchOS

The Apple watchOS operating system.

QOperatingSystemVersion.Windows

The Microsoft Windows operating system.

QOperatingSystemVersion.Unknown

An unknown or unsupported operating system.

PySide6.QtCore.QOperatingSystemVersion.Windows7#
PySide6.QtCore.QOperatingSystemVersion.Windows8#
PySide6.QtCore.QOperatingSystemVersion.Windows8_1#
PySide6.QtCore.QOperatingSystemVersion.Windows10#
PySide6.QtCore.QOperatingSystemVersion.OSXMavericks#
PySide6.QtCore.QOperatingSystemVersion.OSXYosemite#
PySide6.QtCore.QOperatingSystemVersion.OSXElCapitan#
PySide6.QtCore.QOperatingSystemVersion.MacOSSierra#
PySide6.QtCore.QOperatingSystemVersion.MacOSHighSierra#
PySide6.QtCore.QOperatingSystemVersion.MacOSMojave#
PySide6.QtCore.QOperatingSystemVersion.MacOSCatalina#
PySide6.QtCore.QOperatingSystemVersion.MacOSBigSur#
PySide6.QtCore.QOperatingSystemVersion.MacOSMonterey#
PySide6.QtCore.QOperatingSystemVersion.AndroidJellyBean#
PySide6.QtCore.QOperatingSystemVersion.AndroidJellyBean_MR1#
PySide6.QtCore.QOperatingSystemVersion.AndroidJellyBean_MR2#
PySide6.QtCore.QOperatingSystemVersion.AndroidKitKat#
PySide6.QtCore.QOperatingSystemVersion.AndroidLollipop#
PySide6.QtCore.QOperatingSystemVersion.AndroidLollipop_MR1#
PySide6.QtCore.QOperatingSystemVersion.AndroidMarshmallow#
PySide6.QtCore.QOperatingSystemVersion.AndroidNougat#
PySide6.QtCore.QOperatingSystemVersion.AndroidNougat_MR1#
PySide6.QtCore.QOperatingSystemVersion.AndroidOreo#
PySide6.QtCore.QOperatingSystemVersion.AndroidOreo_MR1#
PySide6.QtCore.QOperatingSystemVersion.AndroidPie#
PySide6.QtCore.QOperatingSystemVersion.Android10#
PySide6.QtCore.QOperatingSystemVersion.Android11#
PySide6.QtCore.QOperatingSystemVersion.Windows10_1809#
PySide6.QtCore.QOperatingSystemVersion.Windows10_1903#
PySide6.QtCore.QOperatingSystemVersion.Windows10_1909#
PySide6.QtCore.QOperatingSystemVersion.Windows10_2004#
PySide6.QtCore.QOperatingSystemVersion.Windows10_20H2#
PySide6.QtCore.QOperatingSystemVersion.Windows10_21H1#
PySide6.QtCore.QOperatingSystemVersion.Windows10_21H2#
PySide6.QtCore.QOperatingSystemVersion.Windows10_22H2#
PySide6.QtCore.QOperatingSystemVersion.Windows11#
PySide6.QtCore.QOperatingSystemVersion.Windows11_21H2#
PySide6.QtCore.QOperatingSystemVersion.Windows11_22H2#
PySide6.QtCore.QOperatingSystemVersion.Android12#
PySide6.QtCore.QOperatingSystemVersion.Android12L#
PySide6.QtCore.QOperatingSystemVersion.Android13#
PySide6.QtCore.QOperatingSystemVersion.MacOSVentura#