Hi,
I am trying to set the Root Path of the QFileSystemModel to the desktop on windows 7.
but i don't know how to do this?
i tried QFileSystemModel::setRootPath(QString("")) but did not work.
can any body help?
Thank you
Hi,
I am trying to set the Root Path of the QFileSystemModel to the desktop on windows 7.
but i don't know how to do this?
i tried QFileSystemModel::setRootPath(QString("")) but did not work.
can any body help?
Thank you
hi the following will work
Qt Code:
QFileSystemModel::setRootPath( "c:\\" )To copy to clipboard, switch view to plain text mode
hope it helps
Bala
Set the path to whatever QDesktopServices::storageLocation() returns for QDesktopServices::DesktopLocation.
KillGabio (17th January 2013)
I did just as you said but still the application starts from the drivers path (on windows) not the desktop path
I used the following code
but i want it to be like this photoQt Code:
m_pFileSystemModel = new QFileSystemModel; m_pFileSystemModel->setRootPath(dir); ui->treeView->setModel(m_pFileSystemModel);To copy to clipboard, switch view to plain text mode
The problem is the second picture does not show the true model of the filesystem.
What does line #2 of your snippet return?
the second picture is not Qt application it is a visual basic application and i want to make one like it with Qt.
Line #2 returns "C:\Users\mismael\Desktop"
I know. What I say is that it is not a model of your file system.
And when you set it as the root path of your model it still shows some other directory? Make sure you didn't make any mistakes (e.g. read the root path of the model back to see if it is set to the right location). Note - it will not make the dialog show things such as "libraries", "control panel" and stuff as they are artificial entities that are not part of the file system. If you want the exact same output, use native means to get it.Line #2 returns "C:\Users\mismael\Desktop"
have you done with this?
recently i need my tree to run like the native CMFCShellTreeCtrl either.
if you can mail any tips to my email: seak04#gmail.com will be graceful.
Bookmarks