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.