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.
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.
It is because ".." is really not part of the directory tree, it is only needed if you have a flat, table-like, view.Originally Posted by jamd
Two ways:How to show directory ".."?
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.
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.
What exactly did you try? Maybe you should go for QFileSystemModel instead?
Bookmarks