QDateTime: Deprecate setYMD()
Change-Id: I077332df554fb750666d51486c97724411276679 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
21b5d0e2c3
commit
35b96c0d3d
4
dist/changes-5.0.0
vendored
4
dist/changes-5.0.0
vendored
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user