QFileSystemWatcherclass provides an interface for monitoring files and directories for modifications. 更多 …
def
addPath
(file)
def
addPaths
(files)
def
directories
()
def
文件
()
def
removePath
(file)
def
removePaths
(files)
QFileSystemWatchermonitors the file system for changes to files and directories by watching a list of specified paths.调用
addPath()to watch a particular file or directory. Multiple paths can be added using theaddPaths()function. Existing paths can be removed by using theremovePath()andremovePaths()函数。
QFileSystemWatcherexamines each path added to it. Files that have been added to theQFileSystemWatchercan be accessed using thefiles()function, and directories using thedirectories()函数。
fileChanged()signal is emitted when a file has been modified, renamed or removed from disk. Similarly, thedirectoryChanged()signal is emitted when a directory or its contents is modified or removed. Note thatQFileSystemWatcherstops monitoring files once they have been renamed or removed from disk, and directories once they have been removed from disk.
QFileSystemWatcher
(
[
parent=None
]
)
¶
QFileSystemWatcher(paths[, parent=None])
- param parent
- param paths
字符串列表
构造新的文件系统看守程序对象采用给定
parent
.
构造新的文件系统看守程序对象采用给定
parent
which monitors the specified
paths
列表。
PySide2.QtCore.QFileSystemWatcher.
addPath
(
file
)
¶
file – unicode
bool
添加
path
到文件系统看守程序若
path
存在。路径不被添加若路径不存在 (或路径已被文件系统看守程序所监视)。
若
path
指定目录,
directoryChanged()
signal will be emitted when
path
被修改或从磁盘被移除;否则
fileChanged()
signal is emitted when
path
被修改、被重命名或被移除。
若看守成功,返回 true。
看守失败的原因通常从属系统,但可能包括:资源不存在、访问失败或总看守计数限制 (若平台有限制的话)。
注意
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.
另请参阅
PySide2.QtCore.QFileSystemWatcher.
addPaths
(
文件
)
¶
文件 – 字符串列表
字符串列表
添加每个路径在
paths
到文件系统看守程序。路径不被添加若路径不存在 (或路径已被文件系统看守程序所监视)。
若路径指定目录,
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.
返回值是无法看守的路径的列表。
看守失败的原因通常从属系统,但可能包括:资源不存在、访问失败或总看守计数限制 (若平台有限制的话)。
注意
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
.
另请参阅
PySide2.QtCore.QFileSystemWatcher.
文件
(
)
¶
字符串列表
返回正被看守的文件路径列表。
另请参阅
PySide2.QtCore.QFileSystemWatcher.
removePath
(
file
)
¶
file – unicode
bool
移除指定
path
从文件系统看守程序。
若看守被成功移除,返回 true。
移除看守失败的原因通常从属系统 (如:可能由于路径已被删除)。
另请参阅
PySide2.QtCore.QFileSystemWatcher.
removePaths
(
文件
)
¶
文件 – 字符串列表
字符串列表
移除指定
paths
从文件系统看守程序。
返回值是不能成功取消看守的路径的列表。
移除看守失败的原因通常从属系统 (如:可能由于路径已被删除)。
另请参阅