QTreeView: include root in tree?
I am trying to list a directory using QTreeView, but I would like to include the root in the tree (but no other files from the same level as root). In other words, assuming I am user hovercraft, what I get with
Code:
tree.setModel(&model);
tree.
setRootIndex(model.
index(QDir::homePath()));
is:
-bar
-baz
--naz
--naznaz
--naznaznaz
---todd-is-god
-boz
-foo
What I want is:
-hovercraft
--bar
--baz
---naz
---naznaz
---naznaznaz
----todd-is-god
--boz
--foo
Is there a nobrainer way to do this?
-M
Re: QTreeView: include root in tree?
What if you set tree root index as - model.index(QDir::homePath()).parent() ??
Will that solve ur purpose ?
Re: QTreeView: include root in tree?
Quote:
Originally Posted by
aamer4yu
What if you set tree root index as - model.index(QDir::homePath()).parent() ??
No. :( That gives me:
-bishop
--(files inside bishop)
-eel
--(files inside eel)
-hovercraft
--bar
--baz
---naz
---naznaz
---naznaznaz
----todd-is-god
--boz
--foo
where bishop and eel are other users.