[Qt-interest] [Help] How to remove files with QFileSystemModel and QListView?

Liangdong Shi licesh at gmail.com
Wed Aug 25 16:35:22 CEST 2010


hi:

   I have found that it is difficult to remove files/directories which has
been accessed by QFileSystemModel and QListView.
   I have implemented a simple file explorer with QFileSystemModel and
QListView. The directory is changed through QListView::setRootIndex().
    For example: there's a directory "D:/1/2/3/", I entered into "D:/1/2/3/"
from "D:/", then go up to "D:/". By now, the directory "D:/1/" and "D:/1/2/"
can't be removed from the XP system's explorer. However, I can remove
"D:/1/2/3/"
and can further remove"D:/1/2/" and "D:/1/". Only in this order, can the
whole directory "D:/1/" be removed. In this process, I also find that qt
output these warnings:

QFileSystemWatcher: failed to add paths: D:/1/2/3
QFileSystemWatcher: failed to add paths: D:/1/2

QFileSystemWatcher: failed to add paths: D:/1


when I use QFileSystemModel::rmdir() to remove D:/1/2/3/, returns true. but
the dir is still there unless this application is closed.
when I further remove "D:/1/2/", rmdir() returns false, and qt outputs:

QFileSystemWatcher: FindNextChangeNotification failed!! (????????).


I don't know how to solve this problem. How can I remove the files freely?


Thanks!


Liangdong shi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100825/ee398558/attachment.html 


More information about the Qt-interest-old mailing list