Skip to content

PythonQt.QtCore.QFileSystemWatcher · declarations 001

Back to PythonQt.QtCore.QFileSystemWatcher

addPath

addPath(file: str) -> bool

X.addPath(file) -> bool

Supplemental documentation: Qt 5 reference:

bool QFileSystemWatcher::addPath(const QString \&path)

Adds path to the file system watcher if path exists. The path is not added if it does not exist, or if it is already being monitored by the file system watcher.

If path specifies a directory, the directoryChanged() signal will be emitted when path is modified or removed from disk; otherwise the fileChanged() signal is emitted when path is modified, renamed or removed.

If the watch was successful, true is returned.

Reasons for a watch failure are generally system-dependent, but may include the resource not existing, access failures, or the total watch count limit, if the platform has one.

Note: There may be a system dependent limit to the number of files and directories that can be monitored simultaneously. If this limit is been reached, path will not be monitored, and false is returned.

See also addPaths() and removePath().

Upstream PySide2 reference signatures (binding differences may apply):

addPath(self, file: str) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#addPath

addPaths

addPaths(files: Any) -> tuple

X.addPaths(files) -> tuple

Supplemental documentation: Qt 5 reference:

QStringList QFileSystemWatcher::addPaths(const QStringList \&paths)

Adds each path in paths to the file system watcher. Paths are not added if they not exist, or if they are already being monitored by the file system watcher.

If a path specifies a directory, the directoryChanged() signal will be emitted when the path is modified or removed from disk; otherwise the fileChanged() signal is emitted when the path is modified, renamed, or removed.

The return value is a list of paths that could not be watched.

Reasons for a watch failure are generally system-dependent, but may include the resource not existing, access failures, or the total watch count limit, if the platform has one.

Note: There may be a system dependent limit to the number of files and directories that can be monitored simultaneously. If this limit has been reached, the excess paths will not be monitored, and they will be added to the returned QStringList.

See also addPath() and removePaths().

Upstream PySide2 reference signatures (binding differences may apply):

addPaths(self, files: typing.Sequence[str]) -> typing.List[str]

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#addPaths

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QFileSystemWatcher.destroyed; argument details are not documented.

directories

directories() -> tuple

X.directories() -> tuple

Supplemental documentation: Qt 5 reference:

QStringList QFileSystemWatcher::directories() const

Returns a list of paths to directories that are being watched.

See also files().

Upstream PySide2 reference signatures (binding differences may apply):

directories(self) -> typing.List[str]

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#directories

directoryChanged

directoryChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QFileSystemWatcher.directoryChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QFileSystemWatcher::directoryChanged(const QString \&path)

This signal is emitted when the directory at a specified path is modified (e.g., when a file is added or deleted) or removed from disk. Note that if there are several changes during a short period of time, some of the changes might not emit this signal. However, the last change in the sequence of changes will always generate this signal.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also fileChanged().

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#directoryChanged

fileChanged

fileChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QFileSystemWatcher.fileChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QFileSystemWatcher::fileChanged(const QString \&path)

This signal is emitted when the file at the specified path is modified, renamed or removed from disk.

Note: As a safety measure, many applications save an open file by writing a new file and then deleting the old one. In your slot function, you can check watcher.files().contains(path). If it returns false, check whether the file still exists and then call addPath() to continue watching it.

Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.

See also directoryChanged().

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#fileChanged

files

files() -> tuple

X.files() -> tuple

Supplemental documentation: Qt 5 reference:

QStringList QFileSystemWatcher::files() const

Returns a list of paths to files that are being watched.

See also directories().

Upstream PySide2 reference signatures (binding differences may apply):

files(self) -> typing.List[str]

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#files

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QFileSystemWatcher.objectNameChanged; argument details are not documented.

removePath

removePath(file: str) -> bool

X.removePath(file) -> bool

Supplemental documentation: Qt 5 reference:

bool QFileSystemWatcher::removePath(const QString \&path)

Removes the specified path from the file system watcher.

If the watch is successfully removed, true is returned.

Reasons for watch removal failing are generally system-dependent, but may be due to the path having already been deleted, for example.

See also removePaths() and addPath().

Upstream PySide2 reference signatures (binding differences may apply):

removePath(self, file: str) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#removePath

removePaths

removePaths(files: Any) -> tuple

X.removePaths(files) -> tuple

Supplemental documentation: Qt 5 reference:

QStringList QFileSystemWatcher::removePaths(const QStringList \&paths)

Removes the specified paths from the file system watcher.

The return value is a list of paths which were not able to be unwatched successfully.

Reasons for watch removal failing are generally system-dependent, but may be due to the path having already been deleted, for example.

See also removePath() and addPaths().

Upstream PySide2 reference signatures (binding differences may apply):

removePaths(self, files: typing.Sequence[str]) -> typing.List[str]

Source: https://doc.qt.io/archives/qt-5.15/qfilesystemwatcher.html#removePaths