[][src]Struct qt_core::QOperatingSystemVersion

#[repr(C)]pub struct QOperatingSystemVersion { /* fields omitted */ }

The QOperatingSystemVersion class provides information about the operating system version.

C++ class: QOperatingSystemVersion.

C++ documentation:

The QOperatingSystemVersion class provides information about the operating system version.

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

This class is also a complete replacement for QSysInfo::macVersion and QSysInfo::windowsVersion, additionally providing access to the third (micro) version number component.

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:

PlatformsValue
Androidresult 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 PlatformsmajorVersion, minorVersion, and patchVersion from NSProcessInfo.operatingSystemVersion
WindowsdwMajorVersion, 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:

auto current = QOperatingSystemVersion::current(); if (current >= QOperatingSystemVersion::OSXYosemite || 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.

Methods

impl QOperatingSystemVersion[src]

pub unsafe fn android_jelly_bean() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidJellyBean field.

pub unsafe fn android_jelly_bean_m_r1() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidJellyBean_MR1 field.

pub unsafe fn android_jelly_bean_m_r2() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidJellyBean_MR2 field.

pub unsafe fn android_kit_kat() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidKitKat field.

pub unsafe fn android_lollipop() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidLollipop field.

pub unsafe fn android_lollipop_m_r1() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidLollipop_MR1 field.

pub unsafe fn android_marshmallow() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidMarshmallow field.

pub unsafe fn android_nougat() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidNougat field.

pub unsafe fn android_nougat_m_r1() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidNougat_MR1 field.

pub unsafe fn android_oreo() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the AndroidOreo field.

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QOperatingSystemVersion>>
) -> Ref<QOperatingSystemVersion>
[src]

The QOperatingSystemVersion class provides information about the operating system version.

Calls C++ function: QOperatingSystemVersion& QOperatingSystemVersion::operator=(const QOperatingSystemVersion& other).

C++ documentation:

The QOperatingSystemVersion class provides information about the operating system version.

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

This class is also a complete replacement for QSysInfo::macVersion and QSysInfo::windowsVersion, additionally providing access to the third (micro) version number component.

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:

PlatformsValue
Androidresult 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 PlatformsmajorVersion, minorVersion, and patchVersion from NSProcessInfo.operatingSystemVersion
WindowsdwMajorVersion, 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:

auto current = QOperatingSystemVersion::current(); if (current >= QOperatingSystemVersion::OSXYosemite || 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.

pub unsafe fn current() -> CppBox<QOperatingSystemVersion>[src]

Returns a QOperatingSystemVersion indicating the current OS and its version number.

Calls C++ function: static QOperatingSystemVersion QOperatingSystemVersion::current().

C++ documentation:

Returns a QOperatingSystemVersion indicating the current OS and its version number.

pub unsafe fn current_type() -> OSType[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the current OS type without constructing a QOperatingSystemVersion instance.

Calls C++ function: static QOperatingSystemVersion::OSType QOperatingSystemVersion::currentType().

C++ documentation:

Returns the current OS type without constructing a QOperatingSystemVersion instance.

See also current().

pub unsafe fn mac_o_s_catalina() -> Ref<QOperatingSystemVersion>[src]

This is supported on cpp_lib_version="5.14.0" only.

Returns a reference to the MacOSCatalina field.

pub unsafe fn mac_o_s_high_sierra() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the MacOSHighSierra field.

pub unsafe fn mac_o_s_mojave() -> Ref<QOperatingSystemVersion>[src]

This is supported on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a reference to the MacOSMojave field.

pub unsafe fn mac_o_s_sierra() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the MacOSSierra field.

pub unsafe fn major_version(&self) -> c_int[src]

Returns the major version number, that is, the first segment of the operating system's version number.

Calls C++ function: int QOperatingSystemVersion::majorVersion() const.

C++ documentation:

Returns the major version number, that is, the first segment of the operating system's version number.

See the main class documentation for what the major version number is on a given operating system.

-1 indicates an unknown or absent version number component.

See also minorVersion() and microVersion().

pub unsafe fn micro_version(&self) -> c_int[src]

Returns the micro version number, that is, the third segment of the operating system's version number.

Calls C++ function: int QOperatingSystemVersion::microVersion() const.

C++ documentation:

Returns the micro version number, that is, the third segment of the operating system's version number.

See the main class documentation for what the micro version number is on a given operating system.

-1 indicates an unknown or absent version number component.

See also majorVersion() and minorVersion().

pub unsafe fn minor_version(&self) -> c_int[src]

Returns the minor version number, that is, the second segment of the operating system's version number.

Calls C++ function: int QOperatingSystemVersion::minorVersion() const.

C++ documentation:

Returns the minor version number, that is, the second segment of the operating system's version number.

See the main class documentation for what the minor version number is on a given operating system.

-1 indicates an unknown or absent version number component.

See also majorVersion() and microVersion().

pub unsafe fn name(&self) -> CppBox<QString>[src]

Returns a string representation of the OS type identified by the QOperatingSystemVersion.

Calls C++ function: QString QOperatingSystemVersion::name() const.

C++ documentation:

Returns a string representation of the OS type identified by the QOperatingSystemVersion.

See also type().

pub unsafe fn new_4a(
    os_type: OSType,
    vmajor: c_int,
    vminor: c_int,
    vmicro: c_int
) -> CppBox<QOperatingSystemVersion>
[src]

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

Calls C++ function: [constructor] void QOperatingSystemVersion::QOperatingSystemVersion(QOperatingSystemVersion::OSType osType, int vmajor, int vminor = …, int vmicro = …).

C++ documentation:

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

pub unsafe fn new_3a(
    os_type: OSType,
    vmajor: c_int,
    vminor: c_int
) -> CppBox<QOperatingSystemVersion>
[src]

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

Calls C++ function: [constructor] void QOperatingSystemVersion::QOperatingSystemVersion(QOperatingSystemVersion::OSType osType, int vmajor, int vminor = …).

C++ documentation:

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

pub unsafe fn new_2a(
    os_type: OSType,
    vmajor: c_int
) -> CppBox<QOperatingSystemVersion>
[src]

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

Calls C++ function: [constructor] void QOperatingSystemVersion::QOperatingSystemVersion(QOperatingSystemVersion::OSType osType, int vmajor).

C++ documentation:

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

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QOperatingSystemVersion>>
) -> CppBox<QOperatingSystemVersion>
[src]

The QOperatingSystemVersion class provides information about the operating system version.

Calls C++ function: [constructor] void QOperatingSystemVersion::QOperatingSystemVersion(const QOperatingSystemVersion& other).

C++ documentation:

The QOperatingSystemVersion class provides information about the operating system version.

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

This class is also a complete replacement for QSysInfo::macVersion and QSysInfo::windowsVersion, additionally providing access to the third (micro) version number component.

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:

PlatformsValue
Androidresult 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 PlatformsmajorVersion, minorVersion, and patchVersion from NSProcessInfo.operatingSystemVersion
WindowsdwMajorVersion, 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:

auto current = QOperatingSystemVersion::current(); if (current >= QOperatingSystemVersion::OSXYosemite || 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.

pub unsafe fn o_s_x_el_capitan() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the OSXElCapitan field.

pub unsafe fn o_s_x_mavericks() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the OSXMavericks field.

pub unsafe fn o_s_x_yosemite() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the OSXYosemite field.

pub unsafe fn segment_count(&self) -> c_int[src]

Returns the number of integers stored in the version number.

Calls C++ function: int QOperatingSystemVersion::segmentCount() const.

C++ documentation:

Returns the number of integers stored in the version number.

pub unsafe fn type_(&self) -> OSType[src]

Returns the OS type identified by the QOperatingSystemVersion.

Calls C++ function: QOperatingSystemVersion::OSType QOperatingSystemVersion::type() const.

C++ documentation:

Returns the OS type identified by the QOperatingSystemVersion.

See also name().

pub unsafe fn windows10() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the Windows10 field.

pub unsafe fn windows7() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the Windows7 field.

pub unsafe fn windows8() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the Windows8 field.

pub unsafe fn windows8_1() -> Ref<QOperatingSystemVersion>[src]

Returns a reference to the Windows8_1 field.

Trait Implementations

impl CppDeletable for QOperatingSystemVersion[src]

unsafe fn delete(&self)[src]

The QOperatingSystemVersion class provides information about the operating system version.

Calls C++ function: [destructor] void QOperatingSystemVersion::~QOperatingSystemVersion().

C++ documentation:

The QOperatingSystemVersion class provides information about the operating system version.

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

This class is also a complete replacement for QSysInfo::macVersion and QSysInfo::windowsVersion, additionally providing access to the third (micro) version number component.

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:

PlatformsValue
Androidresult 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 PlatformsmajorVersion, minorVersion, and patchVersion from NSProcessInfo.operatingSystemVersion
WindowsdwMajorVersion, 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:

auto current = QOperatingSystemVersion::current(); if (current >= QOperatingSystemVersion::OSXYosemite || 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.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.