Add QDebug operator for QFileInfo
So far it only shows the path. Change-Id: Ibfecc20ddacce12a178e1ddb297b0e7b91f29f05 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
5f2eee18c9
commit
3d77e1396c
@ -42,6 +42,7 @@
|
|||||||
#include "qglobal.h"
|
#include "qglobal.h"
|
||||||
#include "qdir.h"
|
#include "qdir.h"
|
||||||
#include "qfileinfo_p.h"
|
#include "qfileinfo_p.h"
|
||||||
|
#include "qdebug.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -1445,4 +1446,15 @@ void QFileInfo::setCaching(bool enable)
|
|||||||
Synonym for QList<QFileInfo>.
|
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
|
QT_END_NAMESPACE
|
||||||
|
@ -158,6 +158,10 @@ Q_DECLARE_SHARED(QFileInfo)
|
|||||||
|
|
||||||
typedef QList<QFileInfo> QFileInfoList;
|
typedef QList<QFileInfo> QFileInfoList;
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
Q_CORE_EXPORT QDebug operator<<(QDebug, const QFileInfo &);
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QFileInfo)
|
Q_DECLARE_METATYPE(QFileInfo)
|
||||||
|
Loading…
Reference in New Issue
Block a user