Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.1.1
-
None
-
Windows 7
Description
My application crashes when I delete, create or rename files or directories from outside of it (like in Windows Explorer) while qfilesystemmodel is watching.
It only happens within the watched directory set with setRootPath().
Error message:
ASSERT: "!fileName.isEmpty()" in file dialogs\qfilesystemmodel.cpp, line 1830
In release build the output in QTreeView is garbage.
EDIT: My bad of course since it was a failed assertion. If someone get into trouble with QFileSystemModel and QSortFilterProxyModel while trying to do recursive filtering on the tree, here is what bugged me for a very long time:
while(sourceModel()->canFetchMore(index))
sourceModel()->fetchMore(index);
I never called canFetchMore thinking that fetchMore would fetch all files/directory within a directory referred by the index. This is half true I guess it fetches the number of files but not all there names, so my proxy was asking with indexes which had empty data in the model, and finally the model caught this with an assertion. I not sure though.
Anyway it works now and I spotted the problem was with fetchMore. Closed!