Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qversionnumber.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// Copyright (C) 2022 Intel Corporation.
3// Copyright (C) 2015 Keith Gardner <kreios4004@gmail.com>
4// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
5// Qt-Security score:critical reason:data-parser
6
7#ifndef QVERSIONNUMBER_H
8#define QVERSIONNUMBER_H
9
10#include <QtCore/qcompare.h>
11#include <QtCore/qcontainertools_impl.h>
12#include <QtCore/qlist.h>
13#include <QtCore/qmetatype.h>
14#include <QtCore/qnamespace.h>
15#include <QtCore/qspan.h>
16#include <QtCore/qstring.h>
17#include <QtCore/qtypeinfo.h>
18#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 2
19#include <QtCore/qtyperevision.h>
20#endif // lean headers level 2
21
22QT_BEGIN_NAMESPACE
23
24class QVersionNumber;
25Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed = 0);
26
27#ifndef QT_NO_DATASTREAM
28Q_CORE_EXPORT QDataStream &operator<<(QDataStream &out, const QVersionNumber &version);
29Q_CORE_EXPORT QDataStream &operator>>(QDataStream &in, QVersionNumber &version);
30#endif
31
33{
34 /*
35 * QVersionNumber stores small values inline, without memory allocation.
36 * We do that by setting the LSB in the pointer that would otherwise hold
37 * the longer form of the segments.
38 * The constants below help us deal with the permutations for 32- and 64-bit,
39 * little- and big-endian architectures.
40 */
41 enum {
42 // in little-endian, inline_segments[0] is shared with the pointer's LSB, while
43 // in big-endian, it's inline_segments[7]
44 InlineSegmentMarker = Q_BYTE_ORDER == Q_LITTLE_ENDIAN ? 0 : sizeof(void *) - 1,
45 InlineSegmentStartIdx = !InlineSegmentMarker, // 0 for BE, 1 for LE
46 InlineSegmentCount = sizeof(void *) - 1
47 };
48 static_assert(InlineSegmentCount >= 3); // at least major, minor, micro
49
50 struct SegmentStorage
51 {
52 // Note: we alias the use of dummy and inline_segments in the use of the
53 // union below. This is undefined behavior in C++98, but most compilers implement
54 // the C++11 behavior. The one known exception is older versions of Sun Studio.
55 union {
56 quintptr dummy;
57 qint8 inline_segments[sizeof(void *)];
58 QList<int> *pointer_segments;
59 };
60
61 // set the InlineSegmentMarker and set length to zero
62 SegmentStorage() noexcept : dummy(1) {}
63
64 SegmentStorage(const QList<int> &seg)
65 {
66 if (dataFitsInline(seg.data(), seg.size()))
67 setInlineData(seg.data(), seg.size());
68 else
69 setListData(seg);
70 }
71
72 Q_CORE_EXPORT void setListData(const QList<int> &seg);
73
74 SegmentStorage(const SegmentStorage &other)
75 {
76 if (other.isUsingPointer())
77 setListData(*other.pointer_segments);
78 else
79 dummy = other.dummy;
80 }
81
82 SegmentStorage &operator=(const SegmentStorage &other)
83 {
84 if (isUsingPointer() && other.isUsingPointer()) {
85 *pointer_segments = *other.pointer_segments;
86 } else if (other.isUsingPointer()) {
87 setListData(*other.pointer_segments);
88 } else {
89 if (isUsingPointer())
90 delete pointer_segments;
91 dummy = other.dummy;
92 }
93 return *this;
94 }
95
96 SegmentStorage(SegmentStorage &&other) noexcept
97 : dummy(other.dummy)
98 {
99 other.dummy = 1;
100 }
101
102 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(SegmentStorage)
103
104 void swap(SegmentStorage &other) noexcept
105 {
106 std::swap(dummy, other.dummy);
107 }
108
109 explicit SegmentStorage(QList<int> &&seg)
110 {
111 if (dataFitsInline(std::as_const(seg).data(), seg.size()))
112 setInlineData(std::as_const(seg).data(), seg.size());
113 else
114 setListData(std::move(seg));
115 }
116
117 Q_CORE_EXPORT void setListData(QList<int> &&seg);
118
119 explicit SegmentStorage(QSpan<const int> args)
120 : SegmentStorage(args.begin(), args.end()) {}
121
122 explicit SegmentStorage(const int *first, const int *last)
123 {
124 if (dataFitsInline(first, last - first)) {
126 } else {
128 }
129 }
130
131 Q_CORE_EXPORT void setListData(const int *first, const int *last);
132
133 ~SegmentStorage() { if (isUsingPointer()) delete pointer_segments; }
134
135 bool isUsingPointer() const noexcept
136 { return (inline_segments[InlineSegmentMarker] & 1) == 0; }
137
138 qsizetype size() const noexcept
139 { return isUsingPointer() ? pointer_segments->size() : (inline_segments[InlineSegmentMarker] >> 1); }
140
141 void setInlineSize(qsizetype len)
142 {
143 Q_ASSERT(len <= InlineSegmentCount);
144 inline_segments[InlineSegmentMarker] = qint8(1 + 2 * len);
145 }
146
147 Q_CORE_EXPORT void resize(qsizetype len);
148
149 int at(qsizetype index) const
150 {
151 return isUsingPointer() ?
152 pointer_segments->at(index) :
153 inline_segments[InlineSegmentStartIdx + index];
154 }
155
156 void setSegments(int len, int maj, int min = 0, int mic = 0)
157 {
158 if (maj == qint8(maj) && min == qint8(min) && mic == qint8(mic)) {
159 int data[] = { maj, min, mic };
160 setInlineData(data, len);
161 } else {
162 setVector(len, maj, min, mic);
163 }
164 }
165
166 private:
167 static bool dataFitsInline(const int *data, qsizetype len)
168 {
169 if (len > InlineSegmentCount)
170 return false;
171 for (qsizetype i = 0; i < len; ++i)
172 if (data[i] != qint8(data[i]))
173 return false;
174 return true;
175 }
176 void setInlineData(const int *data, qsizetype len)
177 {
178 Q_ASSERT(len <= InlineSegmentCount);
179 dummy = 1 + len * 2;
180#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
181 for (qsizetype i = 0; i < len; ++i)
182 dummy |= quintptr(data[i] & 0xFF) << (8 * (i + 1));
183#elif Q_BYTE_ORDER == Q_BIG_ENDIAN
184 for (qsizetype i = 0; i < len; ++i)
185 dummy |= quintptr(data[i] & 0xFF) << (8 * (sizeof(void *) - i - 1));
186#else
187 // the code above is equivalent to:
188 setInlineSize(len);
189 for (qsizetype i = 0; i < len; ++i)
190 inline_segments[InlineSegmentStartIdx + i] = data[i] & 0xFF;
191#endif
192 }
193
194 Q_CORE_EXPORT void setVector(int len, int maj, int min, int mic);
195 } m_segments;
196
197 friend class QTypeInfo<SegmentStorage>;
198
199 class It
200 {
201 const QVersionNumber *v;
202 qsizetype i;
203
204 friend class QVersionNumber;
205 explicit constexpr It(const QVersionNumber *vn, qsizetype idx) noexcept : v(vn), i(idx) {}
206
207 friend constexpr bool comparesEqual(const It &lhs, const It &rhs)
208 { Q_ASSERT(lhs.v == rhs.v); return lhs.i == rhs.i; }
209 friend constexpr Qt::strong_ordering compareThreeWay(const It &lhs, const It &rhs)
210 { Q_ASSERT(lhs.v == rhs.v); return Qt::compareThreeWay(lhs.i, rhs.i); }
211 // macro variant does not exist: Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE_NON_NOEXCEPT(It)
212 friend constexpr bool operator==(It lhs, It rhs) {
213 return comparesEqual(lhs, rhs);
214 }
215#ifdef __cpp_lib_three_way_comparison
216 friend constexpr std::strong_ordering operator<=>(It lhs, It rhs) {
217 return compareThreeWay(lhs, rhs);
218 }
219#else
220 friend constexpr bool operator!=(It lhs, It rhs) {
221 return !operator==(lhs, rhs);
222 }
223 friend constexpr bool operator<(It lhs, It rhs) {
224 return is_lt(compareThreeWay(lhs, rhs));
225 }
226 friend constexpr bool operator<=(It lhs, It rhs) {
227 return is_lteq(compareThreeWay(lhs, rhs));
228 }
229 friend constexpr bool operator>(It lhs, It rhs) {
230 return is_gt(compareThreeWay(lhs, rhs));
231 }
232 friend constexpr bool operator>=(It lhs, It rhs) {
233 return is_gteq(compareThreeWay(lhs, rhs));
234 }
235#endif
236
237 public:
238 // Rule Of Zero applies
239 It() = default;
240
241 using iterator_category = std::random_access_iterator_tag;
242 using value_type = int;
243#ifdef QT_COMPILER_HAS_LWG3346
244 using element_type = const int;
245#endif
246 using difference_type = qptrdiff; // difference to container requirements
247 using size_type = qsizetype; // difference to container requirements
248 using reference = value_type; // difference to container requirements
249 using pointer = QtPrivate::ArrowProxy<reference>;
250
251 reference operator*() const { return v->segmentAt(i); }
252 pointer operator->() const { return {**this}; }
253
254 It &operator++() { ++i; return *this; }
255 It operator++(int) { auto copy = *this; ++*this; return copy; }
256
257 It &operator--() { --i; return *this; }
258 It operator--(int) { auto copy = *this; --*this; return copy; }
259
260 It &operator+=(difference_type n) { i += n; return *this; }
261 friend It operator+(It it, difference_type n) { it += n; return it; }
262 friend It operator+(difference_type n, It it) { return it + n; }
263
264 It &operator-=(difference_type n) { i -= n; return *this; }
265 friend It operator-(It it, difference_type n) { it -= n; return it; }
266
267 friend difference_type operator-(It lhs, It rhs)
268 { Q_ASSERT(lhs.v == rhs.v); return lhs.i - rhs.i; }
269
270 reference operator[](difference_type n) const { return *(*this + n); }
271 };
272
273public:
274 using const_iterator = It;
275 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
276
277 using value_type = It::value_type;
278 using difference_type = It::difference_type;
279 using size_type = It::size_type;
280 using reference = It::reference;
282 using pointer = It::pointer;
283 using const_pointer = pointer;
284
285 inline QVersionNumber() noexcept
286 : m_segments()
287 {}
289 inline explicit QVersionNumber(const QList<int> &seg) : m_segments(seg) { }
290
291 // compiler-generated copy/move ctor/assignment operators and the destructor are ok
292
294 explicit QVersionNumber(QList<int> &&seg) : m_segments(std::move(seg)) { }
295
296 inline QVersionNumber(std::initializer_list<int> args)
297 : m_segments(QSpan{args})
298 {}
299
300 explicit QVersionNumber(QSpan<const int> args)
302 {}
303
304 inline explicit QVersionNumber(int maj)
305 { m_segments.setSegments(1, maj); }
306
307 inline explicit QVersionNumber(int maj, int min)
308 { m_segments.setSegments(2, maj, min); }
309
310 inline explicit QVersionNumber(int maj, int min, int mic)
311 { m_segments.setSegments(3, maj, min, mic); }
312
313 [[nodiscard]] inline bool isNull() const noexcept
314 { return segmentCount() == 0; }
315
316 [[nodiscard]] inline bool isNormalized() const noexcept
317 { return isNull() || segmentAt(segmentCount() - 1) != 0; }
318
319 [[nodiscard]] inline int majorVersion() const noexcept
320 { return segmentAt(0); }
321
322 [[nodiscard]] inline int minorVersion() const noexcept
323 { return segmentAt(1); }
324
325 [[nodiscard]] inline int microVersion() const noexcept
326 { return segmentAt(2); }
327
328 [[nodiscard]] Q_CORE_EXPORT QVersionNumber normalized() const;
329
330 [[nodiscard]] Q_CORE_EXPORT QList<int> segments() const;
331
332 [[nodiscard]] inline int segmentAt(qsizetype index) const noexcept
333 { return (m_segments.size() > index) ? m_segments.at(index) : 0; }
334
335 [[nodiscard]] inline qsizetype segmentCount() const noexcept
336 { return m_segments.size(); }
337
338 [[nodiscard]] const_iterator begin() const noexcept { return const_iterator{this, 0}; }
339 [[nodiscard]] const_iterator end() const noexcept { return begin() + segmentCount(); }
340 [[nodiscard]] const_iterator cbegin() const noexcept { return begin(); }
341 [[nodiscard]] const_iterator cend() const noexcept { return end(); }
342
343 [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator{end()}; }
344 [[nodiscard]] const_reverse_iterator rend() const noexcept { return const_reverse_iterator{begin()}; }
345 [[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); }
346 [[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); }
347
348 [[nodiscard]] const_iterator constBegin() const noexcept { return begin(); }
349 [[nodiscard]] const_iterator constEnd() const noexcept { return end(); }
350
351 [[nodiscard]] Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const noexcept;
352
353 [[nodiscard]] Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) noexcept;
354
355 [[nodiscard]] Q_CORE_EXPORT static QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2);
356
357 [[nodiscard]] Q_CORE_EXPORT QString toString() const;
358 [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QAnyStringView string, qsizetype *suffixIndex = nullptr);
359
360#if QT_DEPRECATED_SINCE(6, 4) && QT_POINTER_SIZE != 4
361 Q_WEAK_OVERLOAD
362 QT_DEPRECATED_VERSION_X_6_4("Use the 'qsizetype *suffixIndex' overload.")
363 [[nodiscard]] static QVersionNumber fromString(QAnyStringView string, int *suffixIndex)
364 {
365 QT_WARNING_PUSH
366 // fromString() writes to *n unconditionally, but GCC can't know that
367 QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
368 qsizetype n;
369 auto r = fromString(string, &n);
370 if (suffixIndex) {
371 Q_ASSERT(int(n) == n);
372 *suffixIndex = int(n);
373 }
374 return r;
375 QT_WARNING_POP
376 }
377#endif
378
379
380#if QT_CORE_REMOVED_SINCE(6, 4)
381 [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(const QString &string, int *suffixIndex);
382 [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QLatin1StringView string, int *suffixIndex);
383 [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QStringView string, int *suffixIndex);
384#endif
385
386private:
387 [[nodiscard]] friend bool comparesEqual(const QVersionNumber &lhs,
388 const QVersionNumber &rhs) noexcept
389 {
390 return lhs.segmentCount() == rhs.segmentCount() && compare(lhs, rhs) == 0;
391 }
392 [[nodiscard]] friend Qt::strong_ordering compareThreeWay(const QVersionNumber &lhs,
393 const QVersionNumber &rhs) noexcept
394 {
395 int c = compare(lhs, rhs);
396 return Qt::compareThreeWay(c, 0);
397 }
398 Q_DECLARE_STRONGLY_ORDERED(QVersionNumber)
399
400#ifndef QT_NO_DATASTREAM
401 friend Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QVersionNumber &version);
402#endif
403 friend Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed);
404};
405
407Q_DECLARE_TYPEINFO(QVersionNumber, Q_RELOCATABLE_TYPE);
408
409#ifndef QT_NO_DEBUG_STREAM
410Q_CORE_EXPORT QDebug operator<<(QDebug, const QVersionNumber &version);
411#endif
412
413QT_END_NAMESPACE
414
415QT_DECL_METATYPE_EXTERN(QVersionNumber, Q_CORE_EXPORT)
416
417#endif // QVERSIONNUMBER_H
\inmodule QtCore\reentrant
Definition qdatastream.h:50
friend bool operator<=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept
friend bool operator<(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept
friend bool operator>=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept
constexpr QOperatingSystemVersionBase(OSType osType, int vmajor, int vminor=-1, int vmicro=-1)
bool isAnyOfType(std::initializer_list< OSType > types) const
static Q_CORE_EXPORT bool isAnyOfType(std::initializer_list< OSType > types, OSType type)
friend bool operator>(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs) noexcept
friend Qt::partial_ordering compareThreeWay(const QOperatingSystemVersionBase &lhs, const QOperatingSystemVersionBase &rhs) noexcept
static constexpr OSType currentType()
static Q_CORE_EXPORT int compare(QOperatingSystemVersionBase v1, QOperatingSystemVersionBase v2) noexcept
static constexpr QOperatingSystemVersionBase MacOSSequoia
static constexpr QOperatingSystemVersionBase MacOSTahoe
static constexpr QOperatingSystemVersionBase Windows11_21H2
\variable QOperatingSystemVersion::Windows11_21H2
static constexpr QOperatingSystemVersionBase AndroidNougat
\variable QOperatingSystemVersion::AndroidNougat
static constexpr QOperatingSystemVersionBase Android10
\variable QOperatingSystemVersion::Android10
static constexpr QOperatingSystemVersionBase MacOSSierra
\variable QOperatingSystemVersion::MacOSSierra
static constexpr QOperatingSystemVersionBase MacOSGoldenGate
static constexpr QOperatingSystemVersionBase OSXYosemite
\variable QOperatingSystemVersion::OSXYosemite
static constexpr QOperatingSystemVersionBase Android12L
\variable QOperatingSystemVersion::Android12L
static constexpr QOperatingSystemVersionBase Windows10_1909
\variable QOperatingSystemVersion::Windows10_1909
static constexpr QOperatingSystemVersionBase AndroidKitKat
\variable QOperatingSystemVersion::AndroidKitKat
static constexpr QOperatingSystemVersionBase AndroidJellyBean
\variable QOperatingSystemVersion::MacOSSonoma
static constexpr QOperatingSystemVersionBase AndroidOreo_MR1
\variable QOperatingSystemVersion::AndroidOreo_MR1
static constexpr QOperatingSystemVersionBase Android13
\variable QOperatingSystemVersion::Android13
static constexpr QOperatingSystemVersionBase MacOSCatalina
\variable QOperatingSystemVersion::MacOSCatalina
static constexpr QOperatingSystemVersionBase AndroidLollipop_MR1
\variable QOperatingSystemVersion::AndroidLollipop_MR1
static constexpr QOperatingSystemVersionBase Windows10
\variable QOperatingSystemVersion::Windows10
static constexpr QOperatingSystemVersionBase Windows10_1903
\variable QOperatingSystemVersion::Windows10_1903
static constexpr QOperatingSystemVersionBase Android12
\variable QOperatingSystemVersion::Android12
static constexpr OSType currentType()
Returns the current OS type without constructing a QOperatingSystemVersion instance.
static constexpr QOperatingSystemVersionBase Windows11_23H2
static constexpr QOperatingSystemVersionBase OSXElCapitan
\variable QOperatingSystemVersion::OSXElCapitan
static constexpr QOperatingSystemVersionBase MacOSMojave
\variable QOperatingSystemVersion::MacOSMojave
static constexpr QOperatingSystemVersionBase Windows8
\variable QOperatingSystemVersion::Windows8
static constexpr QOperatingSystemVersionBase AndroidNougat_MR1
\variable QOperatingSystemVersion::AndroidNougat_MR1
static constexpr QOperatingSystemVersionBase Android14
static constexpr QOperatingSystemVersionBase Windows10_2004
\variable QOperatingSystemVersion::Windows10_2004
static constexpr QOperatingSystemVersionBase MacOSHighSierra
\variable QOperatingSystemVersion::MacOSHighSierra
static constexpr QOperatingSystemVersionBase Windows10_21H2
\variable QOperatingSystemVersion::Windows10_21H2
constexpr QOperatingSystemVersion(const QOperatingSystemVersionBase &osversion)
static constexpr QOperatingSystemVersionBase AndroidMarshmallow
\variable QOperatingSystemVersion::AndroidMarshmallow
constexpr QOperatingSystemVersion(OSType osType, int vmajor, int vminor=-1, int vmicro=-1)
Constructs a QOperatingSystemVersion consisting of the OS type osType, and major, minor,...
static constexpr QOperatingSystemVersionBase AndroidJellyBean_MR2
\variable QOperatingSystemVersion::AndroidJellyBean_MR2
static constexpr QOperatingSystemVersionBase Windows10_20H2
\variable QOperatingSystemVersion::Windows10_20H2
static constexpr QOperatingSystemVersionBase AndroidPie
\variable QOperatingSystemVersion::AndroidPie
static constexpr QOperatingSystemVersionBase AndroidOreo
\variable QOperatingSystemVersion::AndroidOreo
static QOperatingSystemVersion current()
Returns a QOperatingSystemVersion indicating the current OS and its version number.
static constexpr QOperatingSystemVersionBase OSXMavericks
\variable QOperatingSystemVersion::Windows11_23H2
static constexpr QOperatingSystemVersionBase MacOSMonterey
\variable QOperatingSystemVersion::MacOSMonterey
static constexpr QOperatingSystemVersionBase Windows7
\variable QOperatingSystemVersion::Windows7
static constexpr QOperatingSystemVersionBase MacOSVentura
\variable QOperatingSystemVersion::MacOSVentura
static constexpr QOperatingSystemVersionBase Windows10_1809
\variable QOperatingSystemVersion::Windows10_1809
static constexpr QOperatingSystemVersionBase AndroidJellyBean_MR1
\variable QOperatingSystemVersion::AndroidJellyBean_MR1
static constexpr QOperatingSystemVersionBase MacOSBigSur
\variable QOperatingSystemVersion::MacOSBigSur
constexpr OSType type() const
Returns the OS type identified by the QOperatingSystemVersion.
static constexpr QOperatingSystemVersionBase AndroidLollipop
\variable QOperatingSystemVersion::AndroidLollipop
static constexpr QOperatingSystemVersionBase Windows8_1
\variable QOperatingSystemVersion::Windows8_1
static constexpr QOperatingSystemVersionBase Windows11_24H2
static constexpr QOperatingSystemVersionBase Windows11_25H2
static constexpr QOperatingSystemVersionBase Windows10_21H1
\variable QOperatingSystemVersion::Windows10_21H1
static constexpr QOperatingSystemVersionBase Windows11_22H2
\variable QOperatingSystemVersion::Windows11_22H2
static constexpr QOperatingSystemVersionBase Windows10_22H2
\variable QOperatingSystemVersion::Windows10_22H2
static constexpr QOperatingSystemVersionBase Android11
\variable QOperatingSystemVersion::Android11
static constexpr QOperatingSystemVersionBase MacOSSonoma
static constexpr QOperatingSystemVersionBase Windows11
\variable QOperatingSystemVersion::Windows11
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:177
\inmodule QtCore
Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const noexcept
Returns true if the current version number is contained in the other version number,...
const_reverse_iterator crbegin() const noexcept
const_iterator cbegin() const noexcept
bool isNull() const noexcept
Returns true if there are zero numerical segments, otherwise returns false.
int minorVersion() const noexcept
Returns the minor version number, that is, the second segment.
friend Qt::strong_ordering compareThreeWay(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
It::reference reference
int majorVersion() const noexcept
Returns the major version number, that is, the first segment.
const_iterator end() const noexcept
const_iterator constEnd() const noexcept
It::value_type value_type
const_reverse_iterator crend() const noexcept
const_reverse_iterator rbegin() const noexcept
Q_WEAK_OVERLOAD QVersionNumber(QList< int > &&seg)
Move-constructs a version number from the list of numbers contained in seg.
qsizetype segmentCount() const noexcept
Returns the number of integers stored in segments().
const_reverse_iterator rend() const noexcept
const_iterator constBegin() const noexcept
bool isNormalized() const noexcept
Returns true if the version number does not contain any trailing zeros, otherwise returns false.
const_iterator cend() const noexcept
Q_WEAK_OVERLOAD QVersionNumber(const QList< int > &seg)
Constructs a version number from the list of numbers contained in seg.
reference const_reference
int segmentAt(qsizetype index) const noexcept
Returns the segment value at index.
int microVersion() const noexcept
Returns the micro version number, that is, the third segment.
static Q_CORE_EXPORT int compare(const QVersionNumber &v1, const QVersionNumber &v2) noexcept
Compares v1 with v2 and returns an integer less than, equal to, or greater than zero,...
const_iterator begin() const noexcept
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2620
static int compareVersionComponents(int lhs, int rhs) noexcept
Q_DECLARE_TYPEINFO(QOperatingSystemVersion, Q_PRIMITIVE_TYPE)
Q_DECLARE_TYPEINFO(QVersionNumber::SegmentStorage, Q_RELOCATABLE_TYPE)
QJSValueList args