Introduce QT_DEPRECATED_SINCE
authorOlivier Goffart <olivier.goffart@nokia.com>
Wed, 8 Jun 2011 09:43:27 +0000 (11:43 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 12 Jul 2011 09:04:04 +0000 (11:04 +0200)
To be used to versionize deprecated symbols

Symbols deprecated in Qt 5.0 need to be inlined

Change-Id: I696a834c25b7e86acf14ae081ea91ef993a5b19e
Reviewed-on: http://codereview.qt.nokia.com/431
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/corelib/global/qglobal.cpp
src/corelib/global/qglobal.h

index ca8b30f..bbc9a15 100644 (file)
@@ -1642,6 +1642,21 @@ bool qSharedBuild()
   \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS
  */
 
+/*!
+  \macro QT_DISABLE_DEPRECATED_BEFORE
+  \relates <QtGlobal>
+
+  This macro can be defined in the project file to disable functions deprecated in
+  a specified version of Qt or any earlier version. The default version number is 5.0,
+  meaning that functions deprecated in or before Qt 5.0 will not be included.
+
+  Examples:
+  When using a future release of Qt 5, set QT_DISABLE_DEPRECATED_BEFORE=0x050100 to
+  disable functions deprecated in Qt 5.1 and earlier. In any release, set
+  QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones
+  deprecated in Qt 5.0
+ */
+
 #if defined(QT_BUILD_QMAKE)
 // needed to bootstrap qmake
 static const unsigned int qt_one = 1;
index 15145ce..1358ea6 100644 (file)
 */
 #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
 
+#ifndef QT_DISABLE_DEPRECATED_BEFORE
+#define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0)
+#endif
+
+/*
+    QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than
+    the deprecation point specified.
+
+    Use it to specify from which version of Qt a function or class has been deprecated
+
+    Example:
+        #if QT_DEPRECATED_SINCE(5,1)
+            QT_DEPRECATED void deprecatedFunction(); //function deprecated sine Qt 5.1
+        #endif
+ */
+#define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE)
+
 #define QT_PACKAGEDATE_STR "YYYY-MM-DD"
 
 #define QT_PACKAGE_TAG ""