PDA

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


jamd
31st May 2006, 10: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, 12: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.