1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qoperatingsystemversion.h"
5
6#if !defined(Q_OS_DARWIN) && !defined(Q_OS_WIN)
7#include "qoperatingsystemversion_p.h"
8#endif
9
10#if defined(Q_OS_DARWIN)
11#include <QtCore/private/qcore_mac_p.h>
12#endif
13
14#include <qversionnumber.h>
15#include <qdebug.h>
16
17#ifdef Q_OS_ANDROID
18#include <QtCore/private/qjnihelpers_p.h>
19#include <QJniObject>
20#endif
21
22QT_BEGIN_NAMESPACE
23
24/*!
25 \class QOperatingSystemVersion
26 \inmodule QtCore
27 \since 5.9
28 \brief The QOperatingSystemVersion class provides information about the
29 operating system version.
30
31 Unlike other version functions in QSysInfo, QOperatingSystemVersion provides
32 access to the full version number that \a developers typically use to vary
33 behavior or determine whether to enable APIs or features based on the
34 operating system version (as opposed to the kernel version number or
35 marketing version).
36
37 Presently, Android, Apple Platforms (iOS, macOS, tvOS, and watchOS),
38 and Windows are supported.
39
40 The \a majorVersion(), \a minorVersion(), and \a microVersion() functions
41 return the parts of the operating system version number based on:
42
43 \table
44 \header
45 \li Platforms
46 \li Value
47 \row
48 \li Android
49 \li result of parsing
50 \l{https://developer.android.com/reference/android/os/Build.VERSION.html#RELEASE}{android.os.Build.VERSION.RELEASE}
51 using QVersionNumber, with a fallback to
52 \l{https://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT}{android.os.Build.VERSION.SDK_INT}
53 to determine the major and minor version component if the former
54 fails
55 \row
56 \li Apple Platforms
57 \li majorVersion, minorVersion, and patchVersion from
58 \l{https://developer.apple.com/reference/foundation/nsprocessinfo/1410906-operatingsystemversion?language=objc}{NSProcessInfo.operatingSystemVersion}
59 \row
60 \li Windows
61 \li dwMajorVersion, dwMinorVersion, and dwBuildNumber from
62 \l{https://docs.microsoft.com/en-us/windows/win32/devnotes/rtlgetversion}
63 {RtlGetVersion} -
64 note that this function ALWAYS return the version number of the
65 underlying operating system, as opposed to the shim underneath
66 GetVersionEx that hides the real version number if the
67 application is not manifested for that version of the OS
68 \endtable
69
70 Because QOperatingSystemVersion stores both a version number and an OS type, the OS type
71 can be taken into account when performing comparisons. For example, on a macOS system running
72 macOS Sierra (v10.12), the following expression will return \c false even though the
73 major version number component of the object on the left hand side of the expression (10) is
74 greater than that of the object on the right (9):
75
76 \snippet code/src_corelib_global_qoperatingsystemversion.cpp 0
77
78 This allows expressions for multiple operating systems to be joined with a logical OR operator
79 and still work as expected. For example:
80
81 \snippet code/src_corelib_global_qoperatingsystemversion.cpp 1
82
83 A more naive comparison algorithm might incorrectly return true on all versions of macOS,
84 including Mac OS 9. This behavior is achieved by overloading the comparison operators to return
85 \c false whenever the OS types of the QOperatingSystemVersion instances being compared do not
86 match. Be aware that due to this it can be the case \c x >= y and \c x < y are BOTH \c false
87 for the same instances of \c x and \c y.
88*/
89
90/*!
91 \enum QOperatingSystemVersion::OSType
92
93 This enum provides symbolic names for the various operating
94 system families supported by QOperatingSystemVersion.
95
96 \value Android The Google Android operating system.
97 \value IOS The Apple iOS operating system.
98 \value MacOS The Apple macOS operating system.
99 \value TvOS The Apple tvOS operating system.
100 \value WatchOS The Apple watchOS operating system.
101 \value Windows The Microsoft Windows operating system.
102
103 \value Unknown An unknown or unsupported operating system.
104*/
105
106/*!
107 \fn QOperatingSystemVersion::QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1)
108
109 Constructs a QOperatingSystemVersion consisting of the OS type \a osType, and
110 major, minor, and micro version numbers \a vmajor, \a vminor and \a vmicro, respectively.
111*/
112
113/*!
114 Returns a QOperatingSystemVersion indicating the current OS and its version number.
115
116 \sa currentType()
117*/
118QOperatingSystemVersion QOperatingSystemVersion::current()
119{
120 return QOperatingSystemVersionBase::current();
121}
122
123QOperatingSystemVersionBase QOperatingSystemVersionBase::current()
124{
125 static const QOperatingSystemVersionBase v = current_impl();
126 return v;
127}
128
129#if !defined(Q_OS_DARWIN) && !defined(Q_OS_WIN)
130QOperatingSystemVersionBase QOperatingSystemVersionBase::current_impl()
131{
132 QOperatingSystemVersionBase version;
133 version.m_os = currentType();
134#ifdef Q_OS_ANDROID
135#ifndef QT_BOOTSTRAPPED
136 const QVersionNumber v = QVersionNumber::fromString(QJniObject::getStaticObjectField(
137 "android/os/Build$VERSION", "RELEASE", "Ljava/lang/String;").toString());
138 if (!v.isNull()) {
139 version.m_major = v.majorVersion();
140 version.m_minor = v.minorVersion();
141 version.m_micro = v.microVersion();
142 return version;
143 }
144#endif
145
146 version.m_major = -1;
147 version.m_minor = -1;
148
149 static const struct {
150 uint major : 4;
151 uint minor : 4;
152 } versions[] = {
153 { 1, 0 }, // API level 1
154 { 1, 1 }, // API level 2
155 { 1, 5 }, // API level 3
156 { 1, 6 }, // API level 4
157 { 2, 0 }, // API level 5
158 { 2, 0 }, // API level 6
159 { 2, 1 }, // API level 7
160 { 2, 2 }, // API level 8
161 { 2, 3 }, // API level 9
162 { 2, 3 }, // API level 10
163 { 3, 0 }, // API level 11
164 { 3, 1 }, // API level 12
165 { 3, 2 }, // API level 13
166 { 4, 0 }, // API level 14
167 { 4, 0 }, // API level 15
168 { 4, 1 }, // API level 16
169 { 4, 2 }, // API level 17
170 { 4, 3 }, // API level 18
171 { 4, 4 }, // API level 19
172 { 4, 4 }, // API level 20
173 { 5, 0 }, // API level 21
174 { 5, 1 }, // API level 22
175 { 6, 0 }, // API level 23
176 { 7, 0 }, // API level 24
177 { 7, 1 }, // API level 25
178 { 8, 0 }, // API level 26
179 { 8, 1 }, // API level 27
180 { 9, 0 }, // API level 28
181 { 10, 0 }, // API level 29
182 { 11, 0 }, // API level 30
183 { 12, 0 }, // API level 31
184 { 12, 0 }, // API level 32
185 { 13, 0 }, // API level 33
186 };
187
188 // This will give us at least the first 2 version components
189 const size_t versionIdx = QtAndroidPrivate::androidSdkVersion() - 1;
190 if (versionIdx < sizeof(versions) / sizeof(versions[0])) {
191 version.m_major = versions[versionIdx].major;
192 version.m_minor = versions[versionIdx].minor;
193 }
194
195 // API level 6 was exactly version 2.0.1
196 version.m_micro = versionIdx == 5 ? 1 : -1;
197#else
198 version.m_major = -1;
199 version.m_minor = -1;
200 version.m_micro = -1;
201#endif
202 return version;
203}
204#endif
205
206static inline int compareVersionComponents(int lhs, int rhs)
207{
208 return lhs >= 0 && rhs >= 0 ? lhs - rhs : 0;
209}
210
211int QOperatingSystemVersionBase::compare(QOperatingSystemVersionBase v1,
212 QOperatingSystemVersionBase v2)
213{
214 if (v1.m_major == v2.m_major) {
215 if (v1.m_minor == v2.m_minor) {
216 return compareVersionComponents(lhs: v1.m_micro, rhs: v2.m_micro);
217 }
218 return compareVersionComponents(lhs: v1.m_minor, rhs: v2.m_minor);
219 }
220 return compareVersionComponents(lhs: v1.m_major, rhs: v2.m_major);
221}
222
223/*!
224 \fn QVersionNumber QOperatingSystemVersion::version() const
225
226 \since 6.1
227
228 Returns the operating system's version number.
229
230 See the main class documentation for what the version number is on a given
231 operating system.
232
233 \sa majorVersion(), minorVersion(), microVersion()
234*/
235
236/*!
237 \fn int QOperatingSystemVersion::majorVersion() const
238
239 Returns the major version number, that is, the first segment of the
240 operating system's version number.
241
242 See the main class documentation for what the major version number is on a given
243 operating system.
244
245 -1 indicates an unknown or absent version number component.
246
247 \sa version(), minorVersion(), microVersion()
248*/
249
250/*!
251 \fn int QOperatingSystemVersion::minorVersion() const
252
253 Returns the minor version number, that is, the second segment of the
254 operating system's version number.
255
256 See the main class documentation for what the minor version number is on a given
257 operating system.
258
259 -1 indicates an unknown or absent version number component.
260
261 \sa version(), majorVersion(), microVersion()
262*/
263
264/*!
265 \fn int QOperatingSystemVersion::microVersion() const
266
267 Returns the micro version number, that is, the third segment of the
268 operating system's version number.
269
270 See the main class documentation for what the micro version number is on a given
271 operating system.
272
273 -1 indicates an unknown or absent version number component.
274
275 \sa version(), majorVersion(), minorVersion()
276*/
277
278/*!
279 \fn int QOperatingSystemVersion::segmentCount() const
280
281 Returns the number of integers stored in the version number.
282*/
283
284/*!
285 \fn QOperatingSystemVersion::OSType QOperatingSystemVersion::type() const
286
287 Returns the OS type identified by the QOperatingSystemVersion.
288
289 \sa name()
290*/
291
292/*!
293 \fn QOperatingSystemVersion::OSType QOperatingSystemVersion::currentType()
294
295 Returns the current OS type without constructing a QOperatingSystemVersion instance.
296
297 \since 5.10
298
299 \sa current()
300*/
301
302/*!
303 \fn QString QOperatingSystemVersion::name() const
304
305 Returns a string representation of the OS type identified by the QOperatingSystemVersion.
306
307 \sa type()
308*/
309QString QOperatingSystemVersion::name() const
310{
311 return QOperatingSystemVersionBase::name();
312}
313
314QString QOperatingSystemVersionBase::name(QOperatingSystemVersionBase osversion)
315{
316 switch (osversion.type()) {
317 case QOperatingSystemVersionBase::Windows:
318 return QStringLiteral("Windows");
319 case QOperatingSystemVersionBase::MacOS: {
320 if (osversion.majorVersion() < 10)
321 return QStringLiteral("Mac OS");
322 if (osversion.majorVersion() == 10 && osversion.minorVersion() < 8)
323 return QStringLiteral("Mac OS X");
324 if (osversion.majorVersion() == 10 && osversion.minorVersion() < 12)
325 return QStringLiteral("OS X");
326 return QStringLiteral("macOS");
327 }
328 case QOperatingSystemVersionBase::IOS: {
329 if (osversion.majorVersion() < 4)
330 return QStringLiteral("iPhone OS");
331 return QStringLiteral("iOS");
332 }
333 case QOperatingSystemVersionBase::TvOS:
334 return QStringLiteral("tvOS");
335 case QOperatingSystemVersionBase::WatchOS:
336 return QStringLiteral("watchOS");
337 case QOperatingSystemVersionBase::Android:
338 return QStringLiteral("Android");
339 case QOperatingSystemVersionBase::Unknown:
340 default:
341 return QString();
342 }
343}
344
345/*!
346 \fn bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) const
347
348 Returns whether the OS type identified by the QOperatingSystemVersion
349 matches any of the OS types in \a types.
350*/
351bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) const
352{
353 // ### Qt7: Remove this function
354 return std::find(first: types.begin(), last: types.end(), val: type()) != types.end();
355}
356
357bool QOperatingSystemVersionBase::isAnyOfType(std::initializer_list<OSType> types, OSType type)
358{
359 return std::find(first: types.begin(), last: types.end(), val: type) != types.end();
360}
361
362#ifndef QT_BOOTSTRAPPED
363
364/*!
365 \variable QOperatingSystemVersion::Windows7
366 \brief a version corresponding to Windows 7 (version 6.1).
367 \since 5.9
368 */
369const QOperatingSystemVersion QOperatingSystemVersion::Windows7 =
370 QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 1);
371
372/*!
373 \variable QOperatingSystemVersion::Windows8
374 \brief a version corresponding to Windows 8 (version 6.2).
375 \since 5.9
376 */
377const QOperatingSystemVersion QOperatingSystemVersion::Windows8 =
378 QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 2);
379
380/*!
381 \variable QOperatingSystemVersion::Windows8_1
382 \brief a version corresponding to Windows 8.1 (version 6.3).
383 \since 5.9
384 */
385const QOperatingSystemVersion QOperatingSystemVersion::Windows8_1 =
386 QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 3);
387
388/*!
389 \variable QOperatingSystemVersion::Windows10
390 \brief a version corresponding to general Windows 10 (version 10.0).
391 \since 5.9
392 */
393const QOperatingSystemVersion QOperatingSystemVersion::Windows10 =
394 QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10);
395
396/*!
397 \variable QOperatingSystemVersion::Windows10_1809
398 \brief a version corresponding to Windows 10 October 2018 Update
399 Version 1809 (version 10.0.17763).
400 \since 6.3
401 */
402const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_1809;
403
404/*!
405 \variable QOperatingSystemVersion::Windows10_1903
406 \brief a version corresponding to Windows 10 May 2019 Update
407 Version 1903 (version 10.0.18362).
408 \since 6.3
409 */
410const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_1903;
411
412/*!
413 \variable QOperatingSystemVersion::Windows10_1909
414 \brief a version corresponding to Windows 10 November 2019 Update
415 Version 1909 (version 10.0.18363).
416 \since 6.3
417 */
418const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_1909;
419
420/*!
421 \variable QOperatingSystemVersion::Windows10_2004
422 \brief a version corresponding to Windows 10 May 2020 Update
423 Version 2004 (version 10.0.19041).
424 \since 6.3
425 */
426const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_2004;
427
428/*!
429 \variable QOperatingSystemVersion::Windows10_20H2
430 \brief a version corresponding to Windows 10 October 2020 Update
431 Version 20H2 (version 10.0.19042).
432 \since 6.3
433 */
434const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_20H2;
435
436/*!
437 \variable QOperatingSystemVersion::Windows10_21H1
438 \brief a version corresponding to Windows 10 May 2021 Update
439 Version 21H1 (version 10.0.19043).
440 \since 6.3
441 */
442const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_21H1;
443
444/*!
445 \variable QOperatingSystemVersion::Windows10_21H2
446 \brief a version corresponding to Windows 10 November 2021 Update
447 Version 21H2 (version 10.0.19044).
448 \since 6.3
449 */
450const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_21H2;
451
452/*!
453 \variable QOperatingSystemVersion::Windows10_22H2
454 \brief a version corresponding to Windows 10 October 2022 Update
455 Version 22H2 (version 10.0.19045).
456 \since 6.5
457 */
458const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_22H2;
459
460/*!
461 \variable QOperatingSystemVersion::Windows11
462 \brief a version corresponding to the initial release of Windows 11
463 (version 10.0.22000).
464 \since 6.3
465 */
466const QOperatingSystemVersionBase QOperatingSystemVersion::Windows11;
467
468/*!
469 \variable QOperatingSystemVersion::Windows11_21H2
470 \brief a version corresponding to Windows 11 Version 21H2 (version 10.0.22000).
471 \since 6.4
472 */
473const QOperatingSystemVersionBase QOperatingSystemVersion::Windows11_21H2;
474
475/*!
476 \variable QOperatingSystemVersion::Windows11_22H2
477 \brief a version corresponding to Windows 11 Version 22H2 (version 10.0.22621).
478 \since 6.4
479 */
480const QOperatingSystemVersionBase QOperatingSystemVersion::Windows11_22H2;
481
482/*!
483 \variable QOperatingSystemVersion::OSXMavericks
484 \brief a version corresponding to OS X Mavericks (version 10.9).
485 \since 5.9
486 */
487const QOperatingSystemVersion QOperatingSystemVersion::OSXMavericks =
488 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 9);
489
490/*!
491 \variable QOperatingSystemVersion::OSXYosemite
492 \brief a version corresponding to OS X Yosemite (version 10.10).
493 \since 5.9
494 */
495const QOperatingSystemVersion QOperatingSystemVersion::OSXYosemite =
496 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 10);
497
498/*!
499 \variable QOperatingSystemVersion::OSXElCapitan
500 \brief a version corresponding to OS X El Capitan (version 10.11).
501 \since 5.9
502 */
503const QOperatingSystemVersion QOperatingSystemVersion::OSXElCapitan =
504 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 11);
505
506/*!
507 \variable QOperatingSystemVersion::MacOSSierra
508 \brief a version corresponding to macOS Sierra (version 10.12).
509 \since 5.9
510 */
511const QOperatingSystemVersion QOperatingSystemVersion::MacOSSierra =
512 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 12);
513
514/*!
515 \variable QOperatingSystemVersion::MacOSHighSierra
516 \brief a version corresponding to macOS High Sierra (version 10.13).
517 \since 5.9.1
518 */
519const QOperatingSystemVersion QOperatingSystemVersion::MacOSHighSierra =
520 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 13);
521
522/*!
523 \variable QOperatingSystemVersion::MacOSMojave
524 \brief a version corresponding to macOS Mojave (version 10.14).
525 \since 5.11.2
526 */
527const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave =
528 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14);
529
530/*!
531 \variable QOperatingSystemVersion::MacOSCatalina
532 \brief a version corresponding to macOS Catalina (version 10.15).
533 \since 5.12.5
534 */
535const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina =
536 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15);
537
538/*!
539 \variable QOperatingSystemVersion::MacOSBigSur
540 \brief a version corresponding to macOS Big Sur (version 11).
541 \since 6.0
542 */
543const QOperatingSystemVersion QOperatingSystemVersion::MacOSBigSur =
544 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 11, 0);
545
546/*!
547 \variable QOperatingSystemVersion::MacOSMonterey
548 \brief a version corresponding to macOS Monterey (version 12).
549 \since 6.3
550 */
551const QOperatingSystemVersion QOperatingSystemVersion::MacOSMonterey =
552 QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 12, 0);
553
554/*!
555 \variable QOperatingSystemVersion::MacOSVentura
556 \brief a version corresponding to macOS Ventura (version 13).
557 \since 6.4
558*/
559const QOperatingSystemVersionBase QOperatingSystemVersion::MacOSVentura;
560
561/*!
562 \variable QOperatingSystemVersion::MacOSSonoma
563 \brief a version corresponding to macOS Sonoma (version 14).
564 \since 6.5
565*/
566const QOperatingSystemVersionBase QOperatingSystemVersion::MacOSSonoma;
567
568/*!
569 \variable QOperatingSystemVersion::AndroidJellyBean
570 \brief a version corresponding to Android Jelly Bean (version 4.1, API level 16).
571 \since 5.9
572 */
573const QOperatingSystemVersion QOperatingSystemVersion::AndroidJellyBean =
574 QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 1);
575
576/*!
577 \variable QOperatingSystemVersion::AndroidJellyBean_MR1
578 \brief a version corresponding to Android Jelly Bean, maintenance release 1
579 (version 4.2, API level 17).
580 \since 5.9
581 */
582const QOperatingSystemVersion QOperatingSystemVersion::AndroidJellyBean_MR1 =
583 QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 2);
584
585/*!
586 \variable QOperatingSystemVersion::AndroidJellyBean_MR2
587 \brief a version corresponding to Android Jelly Bean, maintenance release 2
588 (version 4.3, API level 18).
589 \since 5.9
590 */
591const QOperatingSystemVersion QOperatingSystemVersion::AndroidJellyBean_MR2 =
592 QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 3);
593
594/*!
595 \variable QOperatingSystemVersion::AndroidKitKat
596 \brief a version corresponding to Android KitKat (versions 4.4 & 4.4W, API levels 19 & 20).
597 \since 5.9
598 */
599const QOperatingSystemVersion QOperatingSystemVersion::AndroidKitKat =
600 QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 4);
601
602/*!
603 \variable QOperatingSystemVersion::AndroidLollipop
604 \brief a version corresponding to Android Lollipop (version 5.0, API level 21).
605 \since 5.9
606 */
607const QOperatingSystemVersion QOperatingSystemVersion::AndroidLollipop =
608 QOperatingSystemVersion(QOperatingSystemVersion::Android, 5, 0);
609
610/*!
611 \variable QOperatingSystemVersion::AndroidLollipop_MR1
612 \brief a version corresponding to Android Lollipop, maintenance release 1
613 (version 5.1, API level 22).
614 \since 5.9
615 */
616const QOperatingSystemVersion QOperatingSystemVersion::AndroidLollipop_MR1 =
617 QOperatingSystemVersion(QOperatingSystemVersion::Android, 5, 1);
618
619/*!
620 \variable QOperatingSystemVersion::AndroidMarshmallow
621 \brief a version corresponding to Android Marshmallow (version 6.0, API level 23).
622 \since 5.9
623 */
624const QOperatingSystemVersion QOperatingSystemVersion::AndroidMarshmallow =
625 QOperatingSystemVersion(QOperatingSystemVersion::Android, 6, 0);
626
627/*!
628 \variable QOperatingSystemVersion::AndroidNougat
629 \brief a version corresponding to Android Nougat (version 7.0, API level 24).
630 \since 5.9
631 */
632const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat =
633 QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 0);
634
635/*!
636 \variable QOperatingSystemVersion::AndroidNougat_MR1
637 \brief a version corresponding to Android Nougat, maintenance release 1
638 (version 7.0, API level 25).
639 \since 5.9
640 */
641const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 =
642 QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 1);
643
644/*!
645 \variable QOperatingSystemVersion::AndroidOreo
646 \brief a version corresponding to Android Oreo (version 8.0, API level 26).
647 \since 5.9.2
648 */
649const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo =
650 QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 0);
651
652/*!
653 \variable QOperatingSystemVersion::AndroidOreo_MR1
654 \brief a version corresponding to Android Oreo_MR1 (version 8.1, API level 27).
655 \since 6.1
656 */
657const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo_MR1 =
658 QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 1);
659
660/*!
661 \variable QOperatingSystemVersion::AndroidPie
662 \brief a version corresponding to Android Pie (version 9.0, API level 28).
663 \since 6.1
664 */
665const QOperatingSystemVersion QOperatingSystemVersion::AndroidPie =
666 QOperatingSystemVersion(QOperatingSystemVersion::Android, 9, 0);
667
668/*!
669 \variable QOperatingSystemVersion::Android10
670 \brief a version corresponding to Android 10 (version 10.0, API level 29).
671 \since 6.1
672 */
673const QOperatingSystemVersion QOperatingSystemVersion::Android10 =
674 QOperatingSystemVersion(QOperatingSystemVersion::Android, 10, 0);
675
676/*!
677 \variable QOperatingSystemVersion::Android11
678 \brief a version corresponding to Android 11 (version 11.0, API level 30).
679 \since 6.1
680 */
681const QOperatingSystemVersion QOperatingSystemVersion::Android11 =
682 QOperatingSystemVersion(QOperatingSystemVersion::Android, 11, 0);
683
684/*!
685 \variable QOperatingSystemVersion::Android12
686 \brief a version corresponding to Android 12 (version 12.0, API level 31).
687 \since 6.5
688 */
689const QOperatingSystemVersionBase QOperatingSystemVersion::Android12;
690
691/*!
692 \variable QOperatingSystemVersion::Android12L
693 \brief a version corresponding to Android 12L (version 12.0, API level 32).
694 \since 6.5
695 */
696const QOperatingSystemVersionBase QOperatingSystemVersion::Android12L;
697
698/*!
699 \variable QOperatingSystemVersion::Android13
700 \brief a version corresponding to Android 13 (version 13.0, API level 33).
701 \since 6.5
702 */
703const QOperatingSystemVersionBase QOperatingSystemVersion::Android13;
704
705#endif // !QT_BOOTSTRAPPED
706
707#ifndef QT_NO_DEBUG_STREAM
708QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov)
709{
710 QDebugStateSaver saver(debug);
711 debug.nospace();
712 debug << "QOperatingSystemVersion(" << ov.name()
713 << ", " << ov.majorVersion() << '.' << ov.minorVersion()
714 << '.' << ov.microVersion() << ')';
715 return debug;
716}
717#endif // !QT_NO_DEBUG_STREAM
718
719QT_END_NAMESPACE
720

source code of qtbase/src/corelib/global/qoperatingsystemversion.cpp