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
qtdeprecationmarkers.qdoc
Go to the documentation of this file.
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 \headerfile <QtDeprecationMarkers>
6 \inmodule QtCore
7 \title Qt Deprecation Macros
8
9 \brief The <QtDeprecationMarkers> header file contains deprecation helper macros.
10
11 The header file declares several macros for disabling deprecated Qt APIs
12 and enabling/disabling compiler warnings when they are used.
13*/
14
15/*!
16 \macro QT_DISABLE_DEPRECATED_BEFORE
17 \relates <QtDeprecationMarkers>
18 \deprecated [6.5] Use QT_DISABLE_DEPRECATED_UP_TO instead
19
20 \sa QT_DISABLE_DEPRECATED_UP_TO
21*/
22
23/*!
24 \macro QT_DISABLE_DEPRECATED_UP_TO
25 \relates <QtDeprecationMarkers>
26
27 This macro can be defined in the project file to disable functions
28 deprecated in a specified version of Qt or any earlier version. The default
29 version number is 5.0, meaning that functions deprecated in or before
30 Qt 5.0 will not be included.
31
32 For instance, when preparing to upgrade to Qt 6.3, after eliminating all
33 deprecation warnings, you can set \c{QT_DISABLE_DEPRECATED_UP_TO=0x060300}
34 to exclude from your builds the Qt APIs you no longer use. In your own
35 project's build configuration, this will ensure that anyone adding new calls
36 to the deprecated APIs will know about it right away. If you also build Qt
37 for yourself, including this define in your build configuration for Qt will
38 make your binaries smaller by leaving out even the implementation of the
39 deprecated APIs.
40
41 \note In order to avoid linker errors, the same deprecation level should be
42 used consistently in the entire binary. This means that in static builds
43 the Qt libraries should also be built with \c {QT_DISABLE_DEPRECATED_UP_TO}
44 set to the same version as in the user code. That is because in static
45 build the Qt libraries also become a part of the binary.
46
47 \sa QT_DEPRECATED_WARNINGS, QT_WARN_DEPRECATED_UP_TO
48*/
49
50/*!
51 \macro QT_WARN_DEPRECATED_UP_TO
52 \relates <QtDeprecationMarkers>
53
54 This macro can be defined in the project file to disable deprecation
55 warnings introduced in Qt versions higher than the specified version.
56
57 For instance, when preparing to upgrade to Qt 6.10, if you are not
58 ready to deal with every single deprecation warnings, you can set
59 \c{QT_WARN_DEPRECATED_UP_TO=0x060900} to limit the deprecation
60 warnings to those in 6.9 and earlier.
61
62 \sa QT_DISABLE_DEPRECATED_UP_TO, QT_NO_DEPRECATED_WARNINGS
63*/
64
65/*!
66 \macro QT_DEPRECATED_WARNINGS
67 \relates <QtDeprecationMarkers>
68
69 Since Qt 5.13, this macro has no effect. In Qt 5.12 and before, if this macro
70 is defined, the compiler will generate warnings if any API declared as
71 deprecated by Qt is used.
72
73 \sa QT_DISABLE_DEPRECATED_UP_TO, QT_NO_DEPRECATED_WARNINGS, QT_WARN_DEPRECATED_UP_TO
74*/
75
76/*!
77 \macro QT_NO_DEPRECATED_WARNINGS
78 \relates <QtDeprecationMarkers>
79 \since 5.13
80
81 This macro can be used to suppress deprecation warnings that would otherwise
82 be generated when using deprecated APIs.
83
84 \sa QT_DISABLE_DEPRECATED_UP_TO, QT_WARN_DEPRECATED_UP_TO
85*/