Skip to content

PythonQt.QtCore.QFileInfo · declarations 001

Back to PythonQt.QtCore.QFileInfo

absoluteDir

absoluteDir() -> Any

X.absoluteDir() -> PythonQt.QtCore.QDir

Supplemental documentation: Qt 5 reference:

QDir QFileInfo::absoluteDir() const

Returns the file's absolute path as a QDir object.

See also dir(), filePath(), fileName(), and isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

absoluteDir(self) -> PySide2.QtCore.QDir

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#absoluteDir

absoluteFilePath

absoluteFilePath() -> str

X.absoluteFilePath() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::absoluteFilePath() const

Returns an absolute path including the file name.

The absolute path name consists of the full path and the file name. On Unix this will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'. QFileInfo will uppercase drive letters. Note that QDir does not do this. The code snippet below shows this.

    QFileInfo fi("c:/temp/foo"); => fi.absoluteFilePath() => "C:/temp/foo"

This function returns the same as filePath(), unless isRelative() is true. In contrast to canonicalFilePath(), symbolic links or redundant "." or ".." elements are not necessarily removed.

Warning: If filePath() is empty the behavior of this function is undefined.

See also filePath(), canonicalFilePath(), and isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

absoluteFilePath(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#absoluteFilePath

absolutePath

absolutePath() -> str

X.absolutePath() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::absolutePath() const

Returns a file's path absolute path. This doesn't include the file name.

On Unix the absolute path will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'.

In contrast to canonicalPath() symbolic links or redundant "." or ".." elements are not necessarily removed.

Warning: If filePath() is empty the behavior of this function is undefined.

See also absoluteFilePath(), path(), canonicalPath(), fileName(), and isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

absolutePath(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#absolutePath

baseName

baseName() -> str

X.baseName() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::baseName() const

Returns the base name of the file without the path.

The base name consists of all characters in the file up to (but not including) the first '.' character.

Example:

QFileInfo fi("/temporary/archive.tar.gz");
QString base = fi.baseName();  // base = "archive"

The base name of a file is computed equally on all platforms, independent of file naming conventions (e.g., ".bashrc" on Unix has an empty base name, and the suffix is "bashrc").

See also fileName(), suffix(), completeSuffix(), and completeBaseName().

Upstream PySide2 reference signatures (binding differences may apply):

baseName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#baseName

bundleName

bundleName() -> str

X.bundleName() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::bundleName() const

Returns the name of the bundle.

On macOS and iOS this returns the proper localized name for a bundle if the path isBundle(). On all other platforms an empty QString is returned.

Example:

QFileInfo fi("/Applications/Safari.app");
QString bundle = fi.bundleName();                // name = "Safari"

This function was introduced in Qt 4.3.

See also isBundle(), filePath(), baseName(), and suffix().

Upstream PySide2 reference signatures (binding differences may apply):

bundleName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#bundleName

caching

caching() -> bool

X.caching() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::caching() const

Returns true if caching is enabled; otherwise returns false.

See also setCaching() and refresh().

Upstream PySide2 reference signatures (binding differences may apply):

caching(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#caching

canonicalFilePath

canonicalFilePath() -> str

X.canonicalFilePath() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::canonicalFilePath() const

Returns the canonical path including the file name, i.e. an absolute path without symbolic links or redundant "." or ".." elements.

If the file does not exist, canonicalFilePath() returns an empty string.

See also filePath(), absoluteFilePath(), and dir().

Upstream PySide2 reference signatures (binding differences may apply):

canonicalFilePath(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#canonicalFilePath

canonicalPath

canonicalPath() -> str

X.canonicalPath() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::canonicalPath() const

Returns the file's path canonical path (excluding the file name), i.e. an absolute path without symbolic links or redundant "." or ".." elements.

If the file does not exist, canonicalPath() returns an empty string.

See also path() and absolutePath().

Upstream PySide2 reference signatures (binding differences may apply):

canonicalPath(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#canonicalPath

completeBaseName

completeBaseName() -> str

X.completeBaseName() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::completeBaseName() const

Returns the complete base name of the file without the path.

The complete base name consists of all characters in the file up to (but not including) the last '.' character.

Example:

QFileInfo fi("/temporary/archive.tar.gz");
QString base = fi.completeBaseName();  // base = "archive.tar"

See also fileName(), suffix(), completeSuffix(), and baseName().

Upstream PySide2 reference signatures (binding differences may apply):

completeBaseName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#completeBaseName

completeSuffix

completeSuffix() -> str

X.completeSuffix() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::completeSuffix() const

Returns the complete suffix (extension) of the file.

The complete suffix consists of all characters in the file after (but not including) the first '.'.

Example:

QFileInfo fi("/temporary/archive.tar.gz");
QString ext = fi.completeSuffix();  // ext = "tar.gz"

See also fileName(), suffix(), baseName(), and completeBaseName().

Upstream PySide2 reference signatures (binding differences may apply):

completeSuffix(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#completeSuffix

created

created() -> Any

X.created() -> PythonQt.QtCore.QDateTime

Upstream PySide2 reference signatures (binding differences may apply):

created(self) -> PySide2.QtCore.QDateTime

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#created

dir

dir() -> Any

X.dir() -> PythonQt.QtCore.QDir

Supplemental documentation: Qt 5 reference:

QDir QFileInfo::dir() const

Returns the path of the object's parent directory as a QDir object.

Note: The QDir returned always corresponds to the object's parent directory, even if the QFileInfo represents a directory.

For each of the following, dir() returns the QDir "~/examples/191697".

    QFileInfo fileInfo1("~/examples/191697/.");
    QFileInfo fileInfo2("~/examples/191697/..");
    QFileInfo fileInfo3("~/examples/191697/main.cpp");

For each of the following, dir() returns the QDir ".".

    QFileInfo fileInfo4(".");
    QFileInfo fileInfo5("..");
    QFileInfo fileInfo6("main.cpp");

See also absolutePath(), filePath(), fileName(), isRelative(), and absoluteDir().

Upstream PySide2 reference signatures (binding differences may apply):

dir(self) -> PySide2.QtCore.QDir

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#dir

exists

exists() -> bool

X.exists() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::exists() const

Returns true if the file exists; otherwise returns false.

Note: If the file is a symlink that points to a non-existing file, false is returned.

[static] bool QFileInfo::exists(const QString \&file)

Returns true if the file exists; otherwise returns false.

Note: If file is a symlink that points to a non-existing file, false is returned.

Note: Using this function is faster than using QFileInfo(file).exists() for file system access.

This function was introduced in Qt 5.2.

Upstream PySide2 reference signatures (binding differences may apply):

exists(file: str) -> bool
exists(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#exists

fileName

fileName() -> str

X.fileName() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::fileName() const

Returns the name of the file, excluding the path.

Example:

QFileInfo fi("/temporary/archive.tar.gz");
QString name = fi.fileName();                // name = "archive.tar.gz"

Note that, if this QFileInfo object is given a path ending in a slash, the name of the file is considered empty.

See also isRelative(), filePath(), baseName(), and suffix().

Upstream PySide2 reference signatures (binding differences may apply):

fileName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#fileName

filePath

filePath() -> str

X.filePath() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::filePath() const

Returns the file name, including the path (which may be absolute or relative).

See also absoluteFilePath(), canonicalFilePath(), and isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

filePath(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#filePath

group

group() -> str

X.group() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::group() const

Returns the group of the file. On Windows, on systems where files do not have groups, or if an error occurs, an empty string is returned.

This function can be time consuming under Unix (in the order of milliseconds).

If the file is a symlink, this function returns the owning group of the target (not the symlink).

See also groupId(), owner(), and ownerId().

Upstream PySide2 reference signatures (binding differences may apply):

group(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#group

groupId

groupId() -> int

X.groupId() -> int

Supplemental documentation: Qt 5 reference:

uint QFileInfo::groupId() const

Returns the id of the group the file belongs to.

On Windows and on systems where files do not have groups this function always returns (uint) -2.

If the file is a symlink, this function returns the id of the group owning the target (not the symlink).

See also group(), owner(), and ownerId().

Upstream PySide2 reference signatures (binding differences may apply):

groupId(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#groupId

isAbsolute

isAbsolute() -> bool

X.isAbsolute() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isAbsolute() const

Returns true if the file path is absolute, otherwise returns false (i.e. the path is relative).

Note: Paths starting with a colon (:) are always considered absolute, as they denote a QResource.

See also isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

isAbsolute(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isAbsolute

isBundle

isBundle() -> bool

X.isBundle() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isBundle() const

Returns true if this object points to a bundle or to a symbolic link to a bundle on macOS and iOS; otherwise returns false.

If the file is a symlink, this function returns true if the target is a bundle (not the symlink).

This function was introduced in Qt 4.3.

See also isDir(), isSymLink(), and isFile().

Upstream PySide2 reference signatures (binding differences may apply):

isBundle(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isBundle

isDir

isDir() -> bool

X.isDir() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isDir() const

Returns true if this object points to a directory or to a symbolic link to a directory; otherwise returns false.

If the file is a symlink, this function returns true if the target is a directory (not the symlink).

See also isFile(), isSymLink(), and isBundle().

Upstream PySide2 reference signatures (binding differences may apply):

isDir(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isDir

isExecutable

isExecutable() -> bool

X.isExecutable() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isExecutable() const

Returns true if the file is executable; otherwise returns false.

If the file is a symlink, this function returns true if the target is executable (not the symlink).

See also isReadable(), isWritable(), and permission().

Upstream PySide2 reference signatures (binding differences may apply):

isExecutable(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isExecutable

isFile

isFile() -> bool

X.isFile() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isFile() const

Returns true if this object points to a file or to a symbolic link to a file. Returns false if the object points to something which isn't a file, such as a directory.

If the file is a symlink, this function returns true if the target is a regular file (not the symlink).

See also isDir(), isSymLink(), and isBundle().

Upstream PySide2 reference signatures (binding differences may apply):

isFile(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isFile

isHidden

isHidden() -> bool

X.isHidden() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isHidden() const

Returns true if this is a `hidden' file; otherwise returns false.

Note: This function returns true for the special entries "." and ".." on Unix, even though QDir::entryList threats them as shown. And note that, since this function inspects the file name, on Unix it will inspect the name of the symlink, if this file is a symlink, not the target's name.

On Windows, this function returns true if the target file is hidden (not the symlink).

Upstream PySide2 reference signatures (binding differences may apply):

isHidden(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isHidden

isNativePath

isNativePath() -> bool

X.isNativePath() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isNativePath() const

Returns true if the file path can be used directly with native APIs. Returns false if the file is otherwise supported by a virtual file system inside Qt, such as the Qt Resource System.

Note: Native paths may still require conversion of path separators and character encoding, depending on platform and input requirements of the native API.

This function was introduced in Qt 5.0.

See also QDir::toNativeSeparators(), QFile::encodeName(), filePath(), absoluteFilePath(), and canonicalFilePath().

Upstream PySide2 reference signatures (binding differences may apply):

isNativePath(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isNativePath

isReadable

isReadable() -> bool

X.isReadable() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isReadable() const

Returns true if the user can read the file; otherwise returns false.

If the file is a symlink, this function returns true if the target is readable (not the symlink).

Note: If the NTFS permissions check has not been enabled, the result on Windows will merely reflect whether the file exists.

See also isWritable(), isExecutable(), and permission().

Upstream PySide2 reference signatures (binding differences may apply):

isReadable(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isReadable

isRelative

isRelative() -> bool

X.isRelative() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isRelative() const

Returns true if the file path is relative, otherwise returns false (i.e. the path is absolute). (E.g. under Unix a path is absolute if it begins with a "/").

Note: Paths starting with a colon (:) are always considered absolute, as they denote a QResource.

See also isAbsolute().

Upstream PySide2 reference signatures (binding differences may apply):

isRelative(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isRelative

isRoot

isRoot() -> bool

X.isRoot() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isRoot() const

Returns true if the object points to a directory or to a symbolic link to a directory, and that directory is the root directory; otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

isRoot(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isRoot

isSymLink() -> bool

X.isSymLink() -> bool

Supplemental documentation: Qt 5 reference:

Returns true if this object points to a symbolic link, shortcut, or alias; otherwise returns false.

Symbolic links exist on Unix (including macOS and iOS) and Windows and are typically created by the ln -s or mklink commands, respectively. Opening a symbolic link effectively opens the link's target.

In addition, true will be returned for shortcuts (*.lnk files) on Windows, and aliases on macOS. This behavior is deprecated and will likely change in a future version of Qt. Opening a shortcut or alias will open the .lnk or alias file itself.

Example:

QFileInfo info(fileName);
if (info.isSymLink())
    fileName = info.symLinkTarget();

Note: If the symlink points to a non existing file, exists() returns false.

See also isFile(), isDir(), and symLinkTarget().

Upstream PySide2 reference signatures (binding differences may apply):

isSymLink(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isSymLink

isWritable

isWritable() -> bool

X.isWritable() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::isWritable() const

Returns true if the user can write to the file; otherwise returns false.

If the file is a symlink, this function returns true if the target is writeable (not the symlink).

Note: If the NTFS permissions check has not been enabled, the result on Windows will merely reflect whether the file is marked as Read Only.

See also isReadable(), isExecutable(), and permission().

Upstream PySide2 reference signatures (binding differences may apply):

isWritable(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#isWritable

lastModified

lastModified() -> Any

X.lastModified() -> PythonQt.QtCore.QDateTime

Supplemental documentation: Qt 5 reference:

QDateTime QFileInfo::lastModified() const

Returns the date and local time when the file was last modified.

If the file is a symlink, the time of the target file is returned (not the symlink).

See also birthTime(), lastRead(), metadataChangeTime(), and fileTime().

Upstream PySide2 reference signatures (binding differences may apply):

lastModified(self) -> PySide2.QtCore.QDateTime

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#lastModified

lastRead

lastRead() -> Any

X.lastRead() -> PythonQt.QtCore.QDateTime

Supplemental documentation: Qt 5 reference:

QDateTime QFileInfo::lastRead() const

Returns the date and local time when the file was last read (accessed).

On platforms where this information is not available, returns the same as lastModified().

If the file is a symlink, the time of the target file is returned (not the symlink).

See also birthTime(), lastModified(), metadataChangeTime(), and fileTime().

Upstream PySide2 reference signatures (binding differences may apply):

lastRead(self) -> PySide2.QtCore.QDateTime

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#lastRead

makeAbsolute

makeAbsolute() -> bool

X.makeAbsolute() -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::makeAbsolute()

Converts the file's path to an absolute path if it is not already in that form. Returns true to indicate that the path was converted; otherwise returns false to indicate that the path was already absolute.

See also filePath() and isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

makeAbsolute(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#makeAbsolute

owner

owner() -> str

X.owner() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::owner() const

Returns the owner of the file. On systems where files do not have owners, or if an error occurs, an empty string is returned.

This function can be time consuming under Unix (in the order of milliseconds). On Windows, it will return an empty string unless the NTFS permissions check has been enabled.

If the file is a symlink, this function returns the owner of the target (not the symlink).

See also ownerId(), group(), and groupId().

Upstream PySide2 reference signatures (binding differences may apply):

owner(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#owner

ownerId

ownerId() -> int

X.ownerId() -> int

Supplemental documentation: Qt 5 reference:

uint QFileInfo::ownerId() const

Returns the id of the owner of the file.

On Windows and on systems where files do not have owners this function returns ((uint) -2).

If the file is a symlink, this function returns the id of the owner of the target (not the symlink).

See also owner(), group(), and groupId().

Upstream PySide2 reference signatures (binding differences may apply):

ownerId(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#ownerId

path

path() -> str

X.path() -> str

Supplemental documentation: Qt 5 reference:

QString QFileInfo::path() const

Returns the file's path. This doesn't include the file name.

Note that, if this QFileInfo object is given a path ending in a slash, the name of the file is considered empty and this function will return the entire path.

See also filePath(), absolutePath(), canonicalPath(), dir(), fileName(), and isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

path(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#path

permission

permission(permissions: Any) -> bool

X.permission(permissions) -> bool

Supplemental documentation: Qt 5 reference:

bool QFileInfo::permission(QFile::Permissions permissions) const

Tests for file permissions. The permissions argument can be several flags of type QFile::Permissions OR-ed together to check for permission combinations.

On systems where files do not have permissions this function always returns true.

Note: The result might be inaccurate on Windows if the NTFS permissions check has not been enabled.

Example:

QFileInfo fi("/temporary/archive.tar.gz");
if (fi.permission(QFile::WriteUser | QFile::ReadGroup))
    qWarning("I can change the file; my group can read the file");
if (fi.permission(QFile::WriteGroup | QFile::WriteOther))
    qWarning("The group or others can change the file");

If the file is a symlink, this function checks the permissions of the target (not the symlink).

See also isReadable(), isWritable(), and isExecutable().

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#permission

permissions

permissions() -> Any

X.permissions()

Supplemental documentation: Qt 5 reference:

QFile::Permissions QFileInfo::permissions() const

Returns the complete OR-ed together combination of QFile::Permissions for the file.

Note: The result might be inaccurate on Windows if the NTFS permissions check has not been enabled.

If the file is a symlink, this function returns the permissions of the target (not the symlink).

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#permissions

refresh

refresh() -> None

X.refresh()

Supplemental documentation: Qt 5 reference:

void QFileInfo::refresh()

Refreshes the information about the file, i.e. reads in information from the file system the next time a cached property is fetched.

Upstream PySide2 reference signatures (binding differences may apply):

refresh(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#refresh

setCaching

setCaching(on: bool) -> None

X.setCaching(on)

Supplemental documentation: Qt 5 reference:

void QFileInfo::setCaching(bool enable)

If enable is true, enables caching of file information. If enable is false caching is disabled.

When caching is enabled, QFileInfo reads the file information from the file system the first time it's needed, but generally not later.

Caching is enabled by default.

See also refresh() and caching().

Upstream PySide2 reference signatures (binding differences may apply):

setCaching(self, on: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#setCaching

setFile

setFile(dir: Any, file: Any) -> None

X.setFile(dir, file)

Supplemental documentation: Qt 5 reference:

void QFileInfo::setFile(const QString \&file)

Sets the file that the QFileInfo provides information about to file.

The file can also include an absolute or relative file path. Absolute paths begin with the directory separator (e.g. "/" under Unix) or a drive specification (under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory.

Example:

QFileInfo info("/usr/bin/env");

QString path = info.absolutePath(); // path = /usr/bin
QString base = info.baseName(); // base = env

info.setFile("/etc/hosts");

path = info.absolutePath(); // path = /etc
base = info.baseName(); // base = hosts

See also isFile(), isRelative(), QDir::setCurrent(), and QDir::isRelativePath().

void QFileInfo::setFile(const QFile \&file)

This is an overloaded function.

Sets the file that the QFileInfo provides information about to file.

If file includes a relative path, the QFileInfo will also have a relative path.

See also isRelative().

void QFileInfo::setFile(const QDir \&dir, const QString \&file)

This is an overloaded function.

Sets the file that the QFileInfo provides information about to file in directory dir.

If file includes a relative path, the QFileInfo will also have a relative path.

See also isRelative().

Upstream PySide2 reference signatures (binding differences may apply):

setFile(self, dir: PySide2.QtCore.QDir, file: str) -> None
setFile(self, file: PySide2.QtCore.QFile) -> None
setFile(self, file: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qfileinfo.html#setFile