summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfileinfo.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-05-08 09:01:43 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2017-05-09 09:25:11 +0000
commit3d77e1396cfccff2e4cd2cab93d04c7762d28d57 (patch)
treef87a5f96e00bd3939bddea435fc2cb89796468ef /src/corelib/io/qfileinfo.cpp
parent5f2eee18c918ffb136fa2c491127f933e53345fe (diff)
Add QDebug operator for QFileInfo
So far it only shows the path. Change-Id: Ibfecc20ddacce12a178e1ddb297b0e7b91f29f05 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib/io/qfileinfo.cpp')
-rw-r--r--src/corelib/io/qfileinfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 8025587a8b..baac3117ea 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -42,6 +42,7 @@
#include "qglobal.h"
#include "qdir.h"
#include "qfileinfo_p.h"
+#include "qdebug.h"
QT_BEGIN_NAMESPACE
@@ -1445,4 +1446,15 @@ void QFileInfo::setCaching(bool enable)
Synonym for QList<QFileInfo>.
*/
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QFileInfo &fi)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace();
+ dbg.noquote();
+ dbg << "QFileInfo(" << QDir::toNativeSeparators(fi.filePath()) << ')';
+ return dbg;
+}
+#endif
+
QT_END_NAMESPACE