summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdebug.cpp14
-rw-r--r--src/corelib/io/qdebug.h18
2 files changed, 32 insertions, 0 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index d13e94e096..11f2b9f3c9 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -714,6 +714,20 @@ QDebug &QDebug::resetFormat()
*/
/*!
+ \fn template <class T> QString QDebug::toString(const T &object)
+ \since 6.0
+
+ \include qdebug-toString.qdocinc
+*/
+
+/*!
+ \fn template <class T> QString QDebug::toString(const T *object)
+ \since 6.0
+
+ \include qdebug-toString.qdocinc
+*/
+
+/*!
\fn template <class T> QDebug operator<<(QDebug debug, const QList<T> &list)
\relates QDebug
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 2314b36bda..9a6abc1994 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -173,6 +173,24 @@ public:
inline QDebug &operator<<(QTextStreamManipulator m)
{ stream->ts << m; return *this; }
+
+ template <typename T>
+ static QString toString(const T &object)
+ {
+ QString buffer;
+ QDebug stream(&buffer);
+ stream << object;
+ return buffer;
+ }
+
+ template <typename T>
+ static QString toString(const T *object)
+ {
+ QString buffer;
+ QDebug stream(&buffer);
+ stream << object;
+ return buffer;
+ }
};
Q_DECLARE_SHARED(QDebug)