#[repr(C)]
pub struct QOperatingSystemVersion { /* private fields */ }
Expand description

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.

Implementations§

source§

impl QOperatingSystemVersion

source

pub unsafe fn android_jelly_bean() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidJellyBean field.

source

pub unsafe fn android_jelly_bean_m_r1() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidJellyBean_MR1 field.

source

pub unsafe fn android_jelly_bean_m_r2() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidJellyBean_MR2 field.

source

pub unsafe fn android_kit_kat() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidKitKat field.

source

pub unsafe fn android_lollipop() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidLollipop field.

source

pub unsafe fn android_lollipop_m_r1() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidLollipop_MR1 field.

source

pub unsafe fn android_marshmallow() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidMarshmallow field.

source

pub unsafe fn android_nougat() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidNougat field.

source

pub unsafe fn android_nougat_m_r1() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidNougat_MR1 field.

source

pub unsafe fn android_oreo() -> Ref<QOperatingSystemVersion>

Returns a reference to the AndroidOreo field.

source

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

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.

source

pub unsafe fn current() -> CppBox<QOperatingSystemVersion>

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.

source

pub unsafe fn current_type() -> OSType

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

source

pub unsafe fn mac_o_s_catalina() -> Ref<QOperatingSystemVersion>

Available on cpp_lib_version="5.14.0" only.

Returns a reference to the MacOSCatalina field.

source

pub unsafe fn mac_o_s_high_sierra() -> Ref<QOperatingSystemVersion>

Returns a reference to the MacOSHighSierra field.

source

pub unsafe fn mac_o_s_mojave() -> Ref<QOperatingSystemVersion>

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

source

pub unsafe fn mac_o_s_sierra() -> Ref<QOperatingSystemVersion>

Returns a reference to the MacOSSierra field.

source

pub unsafe fn major_version(&self) -> c_int

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

source

pub unsafe fn micro_version(&self) -> c_int

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

source

pub unsafe fn minor_version(&self) -> c_int

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

source

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

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

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

pub unsafe fn o_s_x_el_capitan() -> Ref<QOperatingSystemVersion>

Returns a reference to the OSXElCapitan field.

source

pub unsafe fn o_s_x_mavericks() -> Ref<QOperatingSystemVersion>

Returns a reference to the OSXMavericks field.

source

pub unsafe fn o_s_x_yosemite() -> Ref<QOperatingSystemVersion>

Returns a reference to the OSXYosemite field.

source

pub unsafe fn segment_count(&self) -> c_int

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.

source

pub unsafe fn type_(&self) -> OSType

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

source

pub unsafe fn windows10() -> Ref<QOperatingSystemVersion>

Returns a reference to the Windows10 field.

source

pub unsafe fn windows7() -> Ref<QOperatingSystemVersion>

Returns a reference to the Windows7 field.

source

pub unsafe fn windows8() -> Ref<QOperatingSystemVersion>

Returns a reference to the Windows8 field.

source

pub unsafe fn windows8_1() -> Ref<QOperatingSystemVersion>

Returns a reference to the Windows8_1 field.

Trait Implementations§

source§

impl CppDeletable for QOperatingSystemVersion

source§

unsafe fn delete(&self)

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.