QDateTime: Deprecate setYMD()
authorJohn Layt <jlayt@kde.org>
Mon, 16 Jan 2012 20:20:39 +0000 (20:20 +0000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 31 Jan 2012 03:02:25 +0000 (04:02 +0100)
Change-Id: I077332df554fb750666d51486c97724411276679
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
dist/changes-5.0.0
src/corelib/tools/qdatetime.cpp
src/corelib/tools/qdatetime.h
src/dbus/qdbusargument.cpp
src/network/access/qftp.cpp
tests/auto/corelib/tools/qdate/tst_qdate.cpp

index cdab797..ad085b3 100644 (file)
@@ -234,6 +234,10 @@ QtCore
   now return an empty QString, QStringRef or QByteArray respectively.
   in Qt 4 they returned a null QString or a null QStringRef.
 
+* QDate, QTime, and QDateTime have undergone important behavioural changes:
+  * QDate::setYMD() is deprecated, use QDate::setDate() instead
+
+
 QtGui
 -----
 * Accessibility has been refactored. The hierachy of accessible objects is implemented via
index 530b9e6..6430e2c 100644 (file)
@@ -832,7 +832,9 @@ QString QDate::toString(const QString& format) const
 #endif //QT_NO_DATESTRING
 
 /*!
-    \obsolete
+    \fn bool setYMD(int y, int m, int d)
+
+    \deprecated in 5.0, use setDate() instead.
 
     Sets the date's year \a y, month \a m, and day \a d.
 
@@ -842,13 +844,6 @@ QString QDate::toString(const QString& format) const
     Use setDate() instead.
 */
 
-bool QDate::setYMD(int y, int m, int d)
-{
-    if (uint(y) <= 99)
-        y += 1900;
-    return setDate(y, m, d);
-}
-
 /*!
     \since 4.2
 
index 1a0526a..056b0de 100644 (file)
@@ -84,7 +84,11 @@ public:
     QString toString(Qt::DateFormat f = Qt::TextDate) const;
     QString toString(const QString &format) const;
 #endif
-    bool setYMD(int y, int m, int d);
+#if QT_DEPRECATED_SINCE(5,0)
+QT_DEPRECATED inline bool setYMD(int y, int m, int d)
+{ if (uint(y) <= 99) y += 1900; return setDate(y, m, d); }
+#endif
+
     bool setDate(int year, int month, int day);
 
     void getDate(int *year, int *month, int *day);
index b88d666..1c2cb6f 100644 (file)
@@ -1134,7 +1134,7 @@ const QDBusArgument &operator>>(const QDBusArgument &a, QDate &date)
     a.endStructure();
 
     if (y != 0 && m != 0 && d != 0)
-        date.setYMD(y, m, d);
+        date.setDate(y, m, d);
     else
         date = QDate();
     return a;
index de3b077..c7ad810 100644 (file)
@@ -472,7 +472,7 @@ static void _q_fixupDateTime(QDateTime *dateTime)
     const int futureTolerance = 86400;
     if (dateTime->secsTo(QDateTime::currentDateTime()) < -futureTolerance) {
         QDate d = dateTime->date();
-        d.setYMD(d.year() - 1, d.month(), d.day());
+        d.setDate(d.year() - 1, d.month(), d.day());
         dateTime->setDate(d);
     }
 }
index 1a1c344..1827b4c 100644 (file)
@@ -703,6 +703,7 @@ void tst_QDate::yearsZeroToNinetyNine()
     QVERIFY(QDate::isValid(1, 2, 3));
     QVERIFY(QDate::isValid(-1, 2, 3));
 
+#if QT_DEPRECATED_SINCE(5,0)
     {
         QDate dt;
         dt.setYMD(1, 2, 3);
@@ -710,6 +711,7 @@ void tst_QDate::yearsZeroToNinetyNine()
         QCOMPARE(dt.month(), 2);
         QCOMPARE(dt.day(), 3);
     }
+#endif
 
     {
         QDate dt;