I've got this on my file System :
- myFolder
- mySubFolder
- Within the TreeView I expand the folder "myFolder".
- Then I rename it as "myFolder_2".
- And finaly I try to rename the folder "mySubFolder" as "mySubFolder_2".
"mySubFolder_2" in is no more considered as a folder but as unknown with a size of -1 bytes and I've got the message : QFileSystemWatcher: failed to add paths: myFolder.
Here is the my source code :
from PyQt4 import QtGui
import sys
app = QtGui.QApplication(sys.argv)
treeView = QtGui.QTreeView()
fileSystemModel = QtGui.QFileSystemModel(treeView)
fileSystemModel.setReadOnly(False)
treeView.setModel(fileSystemModel)
folder = "."
treeView.setRootIndex(fileSystemModel.setRootPath(folder))
treeView.show()
end = app.exec_()
Any help will be welcome.
You need to set the root path on the model before setting it on the treeview: