Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qoperatingsystemversion.h>
Public Member Functions | |
constexpr | QOperatingSystemVersion (const QOperatingSystemVersionBase &osversion) |
constexpr | QOperatingSystemVersion (OSType osType, int vmajor, int vminor=-1, int vmicro=-1) |
Constructs a QOperatingSystemVersion consisting of the OS type osType, and major, minor, and micro version numbers vmajor, vminor and vmicro, respectively. | |
constexpr OSType | type () const |
Returns the OS type identified by the QOperatingSystemVersion. | |
Public Member Functions inherited from QOperatingSystemVersionBase | |
constexpr | QOperatingSystemVersionBase (OSType osType, int vmajor, int vminor=-1, int vmicro=-1) |
QVersionNumber | version () const |
constexpr int | majorVersion () const |
constexpr int | minorVersion () const |
constexpr int | microVersion () const |
constexpr int | segmentCount () const |
bool | isAnyOfType (std::initializer_list< OSType > types) const |
constexpr OSType | type () const |
QString | name () const |
Static Public Member Functions | |
static constexpr OSType | currentType () |
Returns the current OS type without constructing a QOperatingSystemVersion instance. | |
Static Public Member Functions inherited from QOperatingSystemVersionBase | |
static Q_CORE_EXPORT QOperatingSystemVersionBase | current () |
static Q_CORE_EXPORT QString | name (QOperatingSystemVersionBase osversion) |
static Q_CORE_EXPORT bool | isAnyOfType (std::initializer_list< OSType > types, OSType type) |
static constexpr OSType | currentType () |
Additional Inherited Members | |
Public Types inherited from QOperatingSystemVersionBase | |
enum | OSType { Unknown = 0 , Windows , MacOS , IOS , TvOS , WatchOS , Android , VisionOS } |
Protected Member Functions inherited from QOperatingSystemVersionBase | |
QOperatingSystemVersionBase ()=default | |
Static Protected Member Functions inherited from QOperatingSystemVersionBase | |
static Q_CORE_EXPORT int | compare (QOperatingSystemVersionBase v1, QOperatingSystemVersionBase v2) noexcept |
\inmodule QtCore
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).
Presently, Android, Apple Platforms (iOS, macOS, tvOS, watchOS, and visionOS), and Windows are supported.
The majorVersion(), minorVersion(), and microVersion() functions return the parts of the operating system version number based on:
\table \header
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):
This allows expressions for multiple operating systems to be joined with a logical OR operator and still work as expected. For example:
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
.
Definition at line 138 of file qoperatingsystemversion.h.
|
inlineconstexpr |
Definition at line 255 of file qoperatingsystemversion.h.
|
inlineconstexpr |
Constructs a QOperatingSystemVersion consisting of the OS type osType, and major, minor, and micro version numbers vmajor, vminor and vmicro, respectively.
Definition at line 258 of file qoperatingsystemversion.h.
References QOperatingSystemVersionBase::QOperatingSystemVersionBase().
|
inlinestaticconstexpr |
Returns the current OS type without constructing a QOperatingSystemVersion instance.
Definition at line 268 of file qoperatingsystemversion.h.
References QOperatingSystemVersionBase::currentType().
|
inlineconstexpr |
Returns the OS type identified by the QOperatingSystemVersion.
Definition at line 284 of file qoperatingsystemversion.h.
References QOperatingSystemVersionBase::type().
|
staticconstexpr |
\variable QOperatingSystemVersion::Android10
a version corresponding to Android 10 (version 10.0, API level 29).
Definition at line 233 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Android11
a version corresponding to Android 11 (version 11.0, API level 30).
Definition at line 234 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Android12
a version corresponding to Android 12 (version 12.0, API level 31).
Definition at line 249 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Android12L
a version corresponding to Android 12L (version 12.0, API level 32).
Definition at line 250 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Android13
a version corresponding to Android 13 (version 13.0, API level 33).
Definition at line 251 of file qoperatingsystemversion.h.
|
staticconstexpr |
Definition at line 147 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSSonoma
a version corresponding to macOS Sonoma (version 14).
\variable QOperatingSystemVersion::MacOSSequoia
a version corresponding to macOS Sequoia (version 15).
\variable QOperatingSystemVersion::AndroidJellyBean
a version corresponding to Android Jelly Bean (version 4.1, API level 16).
Definition at line 221 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidJellyBean_MR1
a version corresponding to Android Jelly Bean, maintenance release 1 (version 4.2, API level 17).
Definition at line 222 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidJellyBean_MR2
a version corresponding to Android Jelly Bean, maintenance release 2 (version 4.3, API level 18).
Definition at line 223 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidKitKat
a version corresponding to Android KitKat (versions 4.4 & 4.4W, API levels 19 & 20).
Definition at line 224 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidLollipop
a version corresponding to Android Lollipop (version 5.0, API level 21).
Definition at line 225 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidLollipop_MR1
a version corresponding to Android Lollipop, maintenance release 1 (version 5.1, API level 22).
Definition at line 226 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidMarshmallow
a version corresponding to Android Marshmallow (version 6.0, API level 23).
Definition at line 227 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidNougat
a version corresponding to Android Nougat (version 7.0, API level 24).
Definition at line 228 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidNougat_MR1
a version corresponding to Android Nougat, maintenance release 1 (version 7.0, API level 25).
Definition at line 229 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidOreo
a version corresponding to Android Oreo (version 8.0, API level 26).
Definition at line 230 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidOreo_MR1
a version corresponding to Android Oreo_MR1 (version 8.1, API level 27).
Definition at line 231 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::AndroidPie
a version corresponding to Android Pie (version 9.0, API level 28).
Definition at line 232 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSBigSur
a version corresponding to macOS Big Sur (version 11).
Definition at line 218 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSCatalina
a version corresponding to macOS Catalina (version 10.15).
Definition at line 217 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSHighSierra
a version corresponding to macOS High Sierra (version 10.13).
Definition at line 215 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSMojave
a version corresponding to macOS Mojave (version 10.14).
Definition at line 216 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSMonterey
a version corresponding to macOS Monterey (version 12).
Definition at line 219 of file qoperatingsystemversion.h.
|
staticconstexpr |
Definition at line 146 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSSierra
a version corresponding to macOS Sierra (version 10.12).
Definition at line 214 of file qoperatingsystemversion.h.
|
staticconstexpr |
Definition at line 145 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::MacOSVentura
a version corresponding to macOS Ventura (version 13).
Definition at line 253 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::OSXElCapitan
a version corresponding to OS X El Capitan (version 10.11).
Definition at line 213 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows11_23H2
a version corresponding to Windows 11 Version 23H2 (version 10.0.22631).
\variable QOperatingSystemVersion::Windows11_24H2
a version corresponding to Windows 11 Version 24H2 (version 10.0.26100).
\variable QOperatingSystemVersion::OSXMavericks
a version corresponding to OS X Mavericks (version 10.9).
Definition at line 211 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::OSXYosemite
a version corresponding to OS X Yosemite (version 10.10).
Definition at line 212 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10
a version corresponding to general Windows 10 (version 10.0).
Definition at line 209 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_1809
a version corresponding to Windows 10 October 2018 Update Version 1809 (version 10.0.17763).
Definition at line 237 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_1903
a version corresponding to Windows 10 May 2019 Update Version 1903 (version 10.0.18362).
Definition at line 238 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_1909
a version corresponding to Windows 10 November 2019 Update Version 1909 (version 10.0.18363).
Definition at line 239 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_2004
a version corresponding to Windows 10 May 2020 Update Version 2004 (version 10.0.19041).
Definition at line 240 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_20H2
a version corresponding to Windows 10 October 2020 Update Version 20H2 (version 10.0.19042).
Definition at line 241 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_21H1
a version corresponding to Windows 10 May 2021 Update Version 21H1 (version 10.0.19043).
Definition at line 242 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_21H2
a version corresponding to Windows 10 November 2021 Update Version 21H2 (version 10.0.19044).
Definition at line 243 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows10_22H2
a version corresponding to Windows 10 October 2022 Update Version 22H2 (version 10.0.19045).
Definition at line 244 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows11
a version corresponding to the initial release of Windows 11 (version 10.0.22000).
Definition at line 245 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows11_21H2
a version corresponding to Windows 11 Version 21H2 (version 10.0.22000).
Definition at line 246 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows11_22H2
a version corresponding to Windows 11 Version 22H2 (version 10.0.22621).
Definition at line 247 of file qoperatingsystemversion.h.
|
staticconstexpr |
Definition at line 148 of file qoperatingsystemversion.h.
|
staticconstexpr |
Definition at line 149 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows7
a version corresponding to Windows 7 (version 6.1).
Definition at line 206 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows8
a version corresponding to Windows 8 (version 6.2).
Definition at line 207 of file qoperatingsystemversion.h.
|
staticconstexpr |
\variable QOperatingSystemVersion::Windows8_1
a version corresponding to Windows 8.1 (version 6.3).
Definition at line 208 of file qoperatingsystemversion.h.