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
qtversionchecks.cpp
Go to the documentation of this file.
1
// Copyright (C) 2022 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
/*!
5
\headerfile <QtVersionChecks>
6
\inmodule QtCore
7
\ingroup funclists
8
\brief Macros for performing Qt version checks.
9
*/
10
11
/*!
12
\macro QT_VERSION_CHECK(major, minor, patch)
13
\relates <QtVersionChecks>
14
15
Turns the \a major, \a minor and \a patch numbers of a version into an
16
integer that encodes all three. When expressed in hexadecimal, this integer
17
is of form \c 0xMMNNPP wherein \c{0xMM ==} \a major, \c{0xNN ==} \a minor,
18
and \c{0xPP ==} \a patch. This can be compared with another similarly
19
processed version ID.
20
21
Example:
22
23
\snippet code/src_corelib_global_qglobal_widgets.cpp qt-version-check
24
25
\note the parameters are read as integers in the normal way, so should
26
normally be written in decimal (so a \c 0x prefix must be used if writing
27
them in hexadecimal). Thus \c{QT_VERSION_CHECK(5, 15, 0)} is equal to \c
28
0x050f00, which could equally be written \c{QT_VERSION_CHECK(5, 0xf, 0)}.
29
30
\sa QT_VERSION
31
*/
32
33
/*!
34
\macro QT_VERSION
35
\relates <QtVersionChecks>
36
37
This macro expands to a numeric value of the same form as \l
38
QT_VERSION_CHECK() constructs, that specifies the version of Qt with which
39
code using it is compiled. For example, if you compile your application with
40
Qt 6.1.2, the QT_VERSION macro will expand to \c 0x060102, the same as
41
\c{QT_VERSION_CHECK(6, 1, 2)}. Note that this need not agree with the
42
version the application will find itself using at \e runtime.
43
44
You can use QT_VERSION to select the latest Qt features where available
45
while falling back to older implementations otherwise. Using
46
QT_VERSION_CHECK() for the value to compare with is recommended.
47
48
Example:
49
50
\snippet code/src_corelib_global_qglobal_widgets.cpp 1
51
52
\sa QT_VERSION_STR, QT_VERSION_CHECK(), qVersion()
53
*/
qtbase
src
corelib
global
qtversionchecks.cpp
Generated on
for Qt by
1.14.0