Updating directory view in a QListView
Hi there!
I'm trying to display the contents of a directory in a QListView. It works great like this:
Code:
ui.configFileList->setModel(model);
ui.configFileList->setRootIndex(model->index("config"));
But the view doesn't update when I write a file into that directory or drop something there in a file manager. I thought that was the whole model view thing all about. I also tried explicitly calling update() on the widget, nothing. Now after reading the docs and taking a look at the Directory View example to no avail, please help me to make my directory view update automagically.
Re: Updating directory view in a QListView
Use QFileSystemModel instead of QDirModel. The former is kept up to date using QFileSystemWatcher.