Speedup qDebug() << QDate(...)

We really do not need to do string parsing there.

Change-Id: Ie2277d9ff0d0445285b7108023941af111d9baca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Jędrzej Nowacki 2014-07-10 13:43:18 +02:00 committed by Mitch Curtis
parent b6bce68a64
commit 607462019a
2 changed files with 10 additions and 1 deletions

View File

@ -4976,7 +4976,7 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DATESTRING)
QDebug operator<<(QDebug dbg, const QDate &date)
{
dbg.nospace() << "QDate(" << date.toString(QStringLiteral("yyyy-MM-dd")) << ')';
dbg.nospace() << "QDate(" << date.toString(Qt::ISODate) << ')';
return dbg.space();
}

View File

@ -104,6 +104,7 @@ private slots:
void longMonthName() const;
void standaloneLongMonthName() const;
void roundtrip() const;
void qdebug() const;
private:
QDate defDate() const { return QDate(1900, 1, 1); }
QDate invalidDate() const { return QDate(); }
@ -1476,5 +1477,13 @@ void tst_QDate::roundtrip() const
}
}
void tst_QDate::qdebug() const
{
QTest::ignoreMessage(QtDebugMsg, "QDate(\"\")");
qDebug() << QDate();
QTest::ignoreMessage(QtDebugMsg, "QDate(\"1983-08-07\")");
qDebug() << QDate(1983, 8, 7);
}
QTEST_APPLESS_MAIN(tst_QDate)
#include "tst_qdate.moc"