最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - QFileSystemModel::setRootPath behavior does not match documentation under Windows - Stack Overflow

programmeradmin1浏览0评论

The Qt documentation says about QFileSystemModel::setRootPath():

Sets the directory that is being watched by the model to newPath by installing a file system watcher on it. Any changes to files and directories within this directory will be reflected in the model.

.html#setRootPath

Lets say I use setRootPath in the following way:

auto model = new QFileSystemModel;
model->setRootPath("C:\\folder");
treeView->setModel(model);

According to the documentation, the model should now track changes in the specified path C:\\folder. However, the model also tracks changes outside of C:\\folder. Changes are tracked even on other disks.

Why is this happening? How to correctly understand the work of this method? If QFileSystemModel monitors all paths that are visible in QTreeView, then why does the model require a specific path to be monitored? After all, all paths are monitored anyway.

Similar question has been asked on stackoverflow before, but there were no answers. So I decided to ask my own question in the hope that someone else will see it.

发布评论

评论列表(0)

  1. 暂无评论