|
| 1 | +// Copyright (C) 2022 The Qt Company Ltd. |
| 2 | +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only |
| 3 | + |
| 4 | +/*! |
| 5 | + \macro QT_VERSION_CHECK(major, minor, patch) |
| 6 | + \relates <QtVersionChecks> |
| 7 | +
|
| 8 | + Turns the \a major, \a minor and \a patch numbers of a version into an |
| 9 | + integer that encodes all three. When expressed in hexadecimal, this integer |
| 10 | + is of form \c 0xMMNNPP wherein \c{0xMM ==} \a major, \c{0xNN ==} \a minor, |
| 11 | + and \c{0xPP ==} \a patch. This can be compared with another similarly |
| 12 | + processed version ID. |
| 13 | +
|
| 14 | + Example: |
| 15 | +
|
| 16 | + \snippet code/src_corelib_global_qglobal.cpp qt-version-check |
| 17 | +
|
| 18 | + \note the parameters are read as integers in the normal way, so should |
| 19 | + normally be written in decimal (so a \c 0x prefix must be used if writing |
| 20 | + them in hexadecimal). Thus \c{QT_VERSION_CHECK(5, 15, 0)} is equal to \c |
| 21 | + 0x050f00, which could equally be written \c{QT_VERSION_CHECK(5, 0xf, 0)}. |
| 22 | +
|
| 23 | + \sa QT_VERSION |
| 24 | +*/ |
| 25 | + |
| 26 | +/*! |
| 27 | + \macro QT_VERSION |
| 28 | + \relates <QtVersionChecks> |
| 29 | +
|
| 30 | + This macro expands to a numeric value of the same form as \l |
| 31 | + QT_VERSION_CHECK() constructs, that specifies the version of Qt with which |
| 32 | + code using it is compiled. For example, if you compile your application with |
| 33 | + Qt 6.1.2, the QT_VERSION macro will expand to \c 0x060102, the same as |
| 34 | + \c{QT_VERSION_CHECK(6, 1, 2)}. Note that this need not agree with the |
| 35 | + version the application will find itself using at \e runtime. |
| 36 | +
|
| 37 | + You can use QT_VERSION to select the latest Qt features where available |
| 38 | + while falling back to older implementations otherwise. Using |
| 39 | + QT_VERSION_CHECK() for the value to compare with is recommended. |
| 40 | +
|
| 41 | + Example: |
| 42 | +
|
| 43 | + \snippet code/src_corelib_global_qglobal.cpp 16 |
| 44 | +
|
| 45 | + \sa QT_VERSION_STR, QT_VERSION_CHECK(), qVersion() |
| 46 | +*/ |
0 commit comments