PySide6.QtCore.QDirListing.DirEntry

class DirEntry

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

Dereferencing a valid const_iterator returns a DirEntry object.

DirEntry offers a subset of QFileInfo ‘s API (for example, fileName() , filePath() , exists() ). Internally, DirEntry only constructs a QFileInfo object if needed, that is, if the info hasn’t been already fetched by other system functions. You can use fileInfo() to get a QFileInfo . For example:

ItFlag = QDirListing.IteratorFlag()
for dirEntry in QDirListing("/etc", ItFlag::Recursive):
    # Faster
    if dirEntry.fileName().endsWith(u".conf"):
    # This works, but might be potentially slower, since it has to construct a
    # QFileInfo, whereas (depending on the implementation) the fileName could
    # be known already
    if dirEntry.fileInfo().fileName().endsWith(u".conf"):
ItFlag = QDirListing.IteratorFlag()
for dirEntry in QDirListing("/etc", ItFlag::Recursive):
    # Both approaches are the same, because DirEntry will have to construct
    # a QFileInfo to get this info (for example, by calling system stat())
    if dirEntry.size() >= 4'000 /* 4KB */:
    if dirEntry.fileInfo().size() >= 4'000 /* 4KB */:
__repr__()
Return type:

object

absoluteFilePath()
Return type:

str

absolutePath()
Return type:

str

baseName()
Return type:

str

birthTime(tz)
Parameters:

tzQTimeZone

Return type:

QDateTime

bundleName()
Return type:

str

canonicalFilePath()
Return type:

str

completeBaseName()
Return type:

str

completeSuffix()
Return type:

str

exists()
Return type:

bool

fileInfo()
Return type:

QFileInfo

fileName()
Return type:

str

filePath()
Return type:

str

fileTime(type, tz)
Parameters:
Return type:

QDateTime

isDir()
Return type:

bool

isExecutable()
Return type:

bool

isFile()
Return type:

bool

isHidden()
Return type:

bool

isReadable()
Return type:

bool

Return type:

bool

isWritable()
Return type:

bool

lastModified(tz)
Parameters:

tzQTimeZone

Return type:

QDateTime

lastRead(tz)
Parameters:

tzQTimeZone

Return type:

QDateTime

metadataChangeTime(tz)
Parameters:

tzQTimeZone

Return type:

QDateTime

size()
Return type:

int

suffix()
Return type:

str