diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 00177b659e8..bdaaa05768c 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -110,10 +110,8 @@ public: inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(unsigned long t) { stream->ts << t; return maybeSpace(); } - inline QDebug &operator<<(qint64 t) - { stream->ts << QString::number(t); return maybeSpace(); } - inline QDebug &operator<<(quint64 t) - { stream->ts << QString::number(t); return maybeSpace(); } + inline QDebug &operator<<(qint64 t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(quint64 t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); } diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 29c7e6a81eb..80144dba202 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -57,6 +57,7 @@ private slots: void veryLongWarningMessage() const; void qDebugQStringRef() const; void qDebugQLatin1String() const; + void textStreamModifiers() const; void defaultMessagehandler() const; }; @@ -280,6 +281,18 @@ void tst_QDebug::qDebugQLatin1String() const QCOMPARE(QString::fromLatin1(s_function), function); } +void tst_QDebug::textStreamModifiers() const +{ + MessageHandlerSetter mhs(myMessageHandler); + { qDebug() << hex << short(0xf) << int(0xf) << unsigned(0xf) << long(0xf) << qint64(0xf) << quint64(0xf); } + QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; + QCOMPARE(s_msgType, QtDebugMsg); + QCOMPARE(s_msg, QString::fromLatin1("f f f f f f")); + QCOMPARE(QString::fromLatin1(s_file), file); + QCOMPARE(s_line, line); + QCOMPARE(QString::fromLatin1(s_function), function); +} + void tst_QDebug::defaultMessagehandler() const { MessageHandlerSetter mhs(0);