How to initialize the starting path in Qt treeview? -
I want to initialize the early pioneers in QT Trywuv the User Home on Linux Ubuntu.
I tried this code But that does not work.
QString spath = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"; Dirmodel = New QFileSystemModel (this); Dirodel-> Set filter (QDir :: NoDotAndDotDot | QDir :: AllDirs); Dirmodel- & gt; SetRootPath (sPath); UI- & gt; TreeView-> SetModel (dirmodel);
- I have tested spath:
-
/ home /
-
$ {HOME}
-
/ home / Kaspr / Music
-
Nobody does anything. = [
How to solve this?
Thank you for your help.
model setRootIndex
Calling is required:
ui-> treeView-> SetRootIndex (dirmodel-> Index ("/ home / Casper"));
or for any home directory (also works on Windows, OSX, etc.):
ui- & gt; Tree view-> Setter Index (Darmodel-> Index (QDir :: HOMEPATH ());
Comments
Post a Comment