diff --git a/src/corelib/global/qtdeprecationmarkers.h b/src/corelib/global/qtdeprecationmarkers.h index eaf3e7d67f4..46124873c85 100644 --- a/src/corelib/global/qtdeprecationmarkers.h +++ b/src/corelib/global/qtdeprecationmarkers.h @@ -64,6 +64,40 @@ QT_BEGIN_NAMESPACE #define QT_DEPRECATED_SINCE(major, minor) 0 #endif +/* + QT_REMOVAL_QT{VER}_DEPRECATED_SINCE(major, minor) + + The macro should be used if the API is deprecated and should be removed + in the {VER} major release. + + The \a major and \a minor parameters specify the deprecation version. + + For now, we provide the macros to remove the deprecated APIs in Qt 7 + and in Qt 8. + + Example: + + \code + #if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 9) + QT_DEPRECATED_VERSION_X_6_9("The reason for the deprecation") + void deprecatedFunc(); + #endif + \endcode + + The \c {deprecatedFunc()} function is deprecated since Qt 6.9, and will be + completely removed in Qt 7.0. +*/ +#define QT_DEPRECATED_TO_BE_REMOVED_HELPER(dep_major, dep_minor, rem_major) \ + (QT_DEPRECATED_SINCE(dep_major, dep_minor) && (QT_VERSION < QT_VERSION_CHECK(rem_major, 0, 0))) + +// For APIs that should be removed in Qt 7 +#define QT_REMOVAL_QT7_DEPRECATED_SINCE(major, minor) \ + QT_DEPRECATED_TO_BE_REMOVED_HELPER(major, minor, 7) + +// For APIs that should be removed in Qt 8 +#define QT_REMOVAL_QT8_DEPRECATED_SINCE(major, minor) \ + QT_DEPRECATED_TO_BE_REMOVED_HELPER(major, minor, 8) + /* QT_DEPRECATED_VERSION(major, minor) and QT_DEPRECATED_VERSION_X(major, minor, text) outputs a deprecation warning if QT_WARN_DEPRECATED_UP_TO is equal to or greater