QtBase: introduce QT_DEPRECATED_VERSION/QT_DEPRECATED_VERSION_X
QT_DEPRECATED_VERSION(major, minor) and QT_DEPRECATED_VERSION_X(major, minor, text) outputs a deprecation warning if QT_DEPRECATED_WARNINGS_SINCE is equal or greater than the version specified as major, minor. This allows the user to hide deprecation warnings which can't yet be fixed for their codebase because the minimum required Qt version does not provide the replacement function. If QT_DEPRECATED_WARNINGS_SINCE is not set by the user, it's set to QT_DISABLE_DEPRECATED_BEFORE if available, otherwise to QT_VERSION. [ChangeLog][QtCore][QtGlobal] Add new macros QT_DEPRECATED_VERSION and QT_DEPRECATED_VERSION_X to conditionally display deprecation warnings Change-Id: I61b1a7624c9b870695c9e3274313de636f804b5d Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
parent
658f12d735
commit
220028d37c
@ -317,5 +317,6 @@ win32 {
|
|||||||
# On other platforms, Qt's own compilation goes needs to compile the Qt 5.0 API
|
# On other platforms, Qt's own compilation goes needs to compile the Qt 5.0 API
|
||||||
DEFINES *= QT_DISABLE_DEPRECATED_BEFORE=0x050000
|
DEFINES *= QT_DISABLE_DEPRECATED_BEFORE=0x050000
|
||||||
}
|
}
|
||||||
|
DEFINES *= QT_DEPRECATED_WARNINGS_SINCE=0x060000
|
||||||
|
|
||||||
TARGET = $$qt5LibraryTarget($$TARGET$$QT_LIBINFIX) # Do this towards the end
|
TARGET = $$qt5LibraryTarget($$TARGET$$QT_LIBINFIX) # Do this towards the end
|
||||||
|
@ -307,6 +307,14 @@ typedef double qreal;
|
|||||||
# define QT_DEPRECATED_CONSTRUCTOR
|
# define QT_DEPRECATED_CONSTRUCTOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef QT_DEPRECATED_WARNINGS_SINCE
|
||||||
|
# ifdef QT_DISABLE_DEPRECATED_BEFORE
|
||||||
|
# define QT_DEPRECATED_WARNINGS_SINCE QT_DISABLE_DEPRECATED_BEFORE
|
||||||
|
# else
|
||||||
|
# define QT_DEPRECATED_WARNINGS_SINCE QT_VERSION
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef QT_DISABLE_DEPRECATED_BEFORE
|
#ifndef QT_DISABLE_DEPRECATED_BEFORE
|
||||||
#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0)
|
#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0)
|
||||||
#endif
|
#endif
|
||||||
@ -329,6 +337,51 @@ typedef double qreal;
|
|||||||
#define QT_DEPRECATED_SINCE(major, minor) 0
|
#define QT_DEPRECATED_SINCE(major, minor) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
QT_DEPRECATED_VERSION(major, minor) and QT_DEPRECATED_VERSION_X(major, minor, text)
|
||||||
|
outputs a deprecation warning if QT_DEPRECATED_WARNINGS_SINCE is equal or greater
|
||||||
|
than the version specified as major, minor. This makes it possible to deprecate a
|
||||||
|
function without annoying a user who needs to stick at a specified minimum version
|
||||||
|
and therefore can't use the new function.
|
||||||
|
*/
|
||||||
|
#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 12, 0)
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_12(text) QT_DEPRECATED_X(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_12 QT_DEPRECATED
|
||||||
|
#else
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_12(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 13, 0)
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_13(text) QT_DEPRECATED_X(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_13 QT_DEPRECATED
|
||||||
|
#else
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_13(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_14(text) QT_DEPRECATED_X(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_14 QT_DEPRECATED
|
||||||
|
#else
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_14(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_14
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_15(text) QT_DEPRECATED_X(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_15 QT_DEPRECATED
|
||||||
|
#else
|
||||||
|
# define QT_DEPRECATED_VERSION_X_5_15(text)
|
||||||
|
# define QT_DEPRECATED_VERSION_5_15
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define QT_DEPRECATED_VERSION_X_5(minor, text) QT_DEPRECATED_VERSION_X_5_##minor(text)
|
||||||
|
#define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major(minor, text)
|
||||||
|
|
||||||
|
#define QT_DEPRECATED_VERSION_5(minor) QT_DEPRECATED_VERSION_5_##minor()
|
||||||
|
#define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major(minor)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The Qt modules' export macros.
|
The Qt modules' export macros.
|
||||||
The options are:
|
The options are:
|
||||||
|
@ -226,13 +226,13 @@ Q_SIGNALS:
|
|||||||
void currentIndexChanged(int index);
|
void currentIndexChanged(int index);
|
||||||
void currentTextChanged(const QString &);
|
void currentTextChanged(const QString &);
|
||||||
#if QT_DEPRECATED_SINCE(5, 13)
|
#if QT_DEPRECATED_SINCE(5, 13)
|
||||||
QT_DEPRECATED_X("Use currentTextChanged() instead")
|
QT_DEPRECATED_VERSION_X(5, 13, "Use currentTextChanged() instead")
|
||||||
void currentIndexChanged(const QString &);
|
void currentIndexChanged(const QString &);
|
||||||
#endif
|
#endif
|
||||||
#if QT_DEPRECATED_SINCE(5, 15)
|
#if QT_DEPRECATED_SINCE(5, 15)
|
||||||
QT_DEPRECATED_X("Use textActivated() instead")
|
QT_DEPRECATED_VERSION_X(5, 15, "Use textActivated() instead")
|
||||||
void activated(const QString &);
|
void activated(const QString &);
|
||||||
QT_DEPRECATED_X("Use textHighlighted() instead")
|
QT_DEPRECATED_VERSION_X(5, 15, "Use textHighlighted() instead")
|
||||||
void highlighted(const QString &);
|
void highlighted(const QString &);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user