PDA

View Full Version : QDirModel - show directory ".."?



jamd
31st May 2006, 09:59
Using QTreeView and QDirModel can access local
file system but the directory ".." does not appear.

How to show directory ".."?

Appears on the following way:

(none)
|-AA
|-BB

I want:

directory
|-AA
|-BB


Thanks.

wysota
2nd June 2006, 11:15
Using QTreeView and QDirModel can access local
file system but the directory ".." does not appear.
It is because ".." is really not part of the directory tree, it is only needed if you have a flat, table-like, view.


How to show directory ".."?
Two ways:
1. Subclass QDirModel and reimplement for example data(), rowCount() and maybe some others
2. Subclass QAbstractProxyModel and implement a proxy between the dir model and the view which will add the item on the view's side.

Fred
22nd April 2009, 15:56
I have the same problem, could you post some more information or code, please?
I don't know how to subclass the QDirModel so that ".." is displayed first. All my attempts didn't work.

wysota
23rd April 2009, 19:51
What exactly did you try? Maybe you should go for QFileSystemModel instead?