DtkCore
DTK Core module
载入中...
搜索中...
未找到
Dtk::Core::DFileSystemWatcher类 参考
类 Dtk::Core::DFileSystemWatcher 继承关系图:
Dtk::Core::DObject

信号

void fileDeleted (const QString &path, const QString &name, QPrivateSignal)
 
void fileAttributeChanged (const QString &path, const QString &name, QPrivateSignal)
 
void fileClosed (const QString &path, const QString &name, QPrivateSignal)
 
void fileMoved (const QString &fromPath, const QString &fromName, const QString &toPath, const QString &toName, QPrivateSignal)
 
void fileCreated (const QString &path, const QString &name, QPrivateSignal)
 
void fileModified (const QString &path, const QString &name, QPrivateSignal)
 

Public 成员函数

 DFileSystemWatcher (QObject *parent=Q_NULLPTR)
 构造函数,构造一个新的文件系统监视器对象。
 
 DFileSystemWatcher (const QStringList &paths, QObject *parent=Q_NULLPTR)
 构造函数,构造一个新的文件系统监视器对象,监控指定路径列表。
 
bool addPath (const QString &file)
 添加要监听的路径
 
QStringList addPaths (const QStringList &files)
 添加要监听的路径列表
 
bool removePath (const QString &file)
 移除监听的路径
 
QStringList removePaths (const QStringList &files)
 移除监听的路径列表
 
QStringList files () const
 获取监听的文件列表
 
QStringList directories () const
 获取监听的目录列表
 

额外继承的成员函数

- Protected 成员函数 继承自 Dtk::Core::DObject
 DObject (DObject *parent=nullptr)
 
 DObject (DObjectPrivate &dd, DObject *parent=nullptr)
 
- Protected 属性 继承自 Dtk::Core::DObject
QScopedPointer< DObjectPrivated_d_ptr
 

构造及析构函数说明

◆ DFileSystemWatcher()

DFileSystemWatcher::DFileSystemWatcher ( const QStringList &  paths,
QObject *  parent = Q_NULLPTR 
)

构造函数,构造一个新的文件系统监视器对象,监控指定路径列表。

参数
paths要监听的路径列表

成员函数说明

◆ addPath()

bool DFileSystemWatcher::addPath ( const QString &  file)

添加要监听的路径

如果path存在,则将path添加到文件系统监视器。如果path不存在或已经存在,则不添加它由文件系统监视程序监视。
如果path指定了一个目录,则调用directoryChanged()信号将在path被修改或从磁盘中删除时发出。否则,当path被修改、重命名或删除。,就会触发fileChanged()信号
如果监视成功,则返回true。
监视故障的原因通常与系统有关,但是可能包括资源不存在、访问失败或总监视数量限制,如果平台有一个。

注解
可能有一个系统依赖的数量限制可以同时监控的文件和目录。
如果达到了这个限制,path将不会被监控,返回false。
参数
[in]file要监听的路径
参见
DFileSystemWatcher::addPaths()
DFileSystemWatcher::removePath()

◆ addPaths()

QStringList DFileSystemWatcher::addPaths ( const QStringList &  files)

添加要监听的路径列表

将path中的每个path添加到文件系统监视程序。path如果不存在,或者已经存在,则不添加由文件系统监视程序监视。
如果path指定了一个目录,则调用directoryChanged()信号将在path被修改或从磁盘中删除时触发。否则,当path被修改、重命名或删除。,就会触发fileChanged()信号
返回值是一个无法被监视的路径列表。
监视故障的原因通常与系统有关,但是可能包括资源不存在、访问失败或总监视数量限制,如果平台有一个。

注解
可能有一个系统依赖的数量限制可以同时监控的文件和目录。
如果达到了这个限制,多余的path就不会达到,它们将被添加到返回的QStringList中。
参数
[in]files要监听的路径列表
参见
DFileSystemWatcher::addPath()
DFileSystemWatcher::removePaths()

◆ directories()

QStringList DFileSystemWatcher::directories ( ) const

获取监听的目录列表

参见
DFileSystemWatcher::files()

◆ files()

QStringList DFileSystemWatcher::files ( ) const

获取监听的文件列表

参见
DFileSystemWatcher::directories()

◆ removePath()

bool DFileSystemWatcher::removePath ( const QString &  file)

移除监听的路径

从文件系统监视程序中删除指定的path。
如果监视成功删除,则返回true。
监视删除失败的原因通常与系统有关,但可能是因为path已经被删除了。

参见
DFileSystemWatcher::removePaths()
DFileSystemWatcher::addPath()

◆ removePaths()

QStringList DFileSystemWatcher::removePaths ( const QStringList &  files)

移除监听的路径列表

从文件系统监视程序中删除指定的path。
返回值是一个无法被监视的路径列表。
监视删除失败的原因通常与系统有关,但可能是因为path已经被删除了。

参见
DFileSystemWatcher::removePath()
DFileSystemWatcher::addPaths()

该类的文档由以下文件生成: