gpt4 book ai didi

c++ - QFileSystemWatcher::addPath 递归

转载 作者:行者123 更新时间:2023-11-28 03:30:17 33 4
gpt4 key购买 nike

大家好我想使用QFileSystemWatcher递归地观察给定目录及其子目录的变化,但是void QFileSystemWatcher::addPath (const QString & path)没有不要让我这样做,所以有没有什么想法可以轻松地做到这一点,或者我应该自己实现它(提取所有目录和子目录和文件以添加 void QFileSystemWatcher::addPaths (const QStringList & paths ))?

我们将不胜感激。

提前谢谢你。

最佳答案

documentation QFileSystemWatcher 类没有说明递归监视是其契约的一部分。所以我认为一个解决方案可能是,正如你所暗示的那样,自己遍历目录树,将所有子目录及其文件收集在一个字符串列表中并使用

void QFileSystemWatcher::addPaths ( const QStringList & paths )

此外,我认为提及您正在使用的 qt 版本可能对您有用,因为根据此 thread , QFileSystemWatcher 已被弃用,新的​​ api 应该会取而代之。

关于c++ - QFileSystemWatcher::addPath 递归,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12759131/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com