Solved Set Path doesnt work ~ QFileSystemModel
-
this is my code
QString openfolderproj = QFileDialog::getExistingDirectory(this, tr("Open a Project Folder"), "C:/Users/", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); filemodel = new QFileSystemModel(this); filemodel->setRootPath(openfolderproj); ui->fileExplorer->setModel(filemodel);
i did all,but it still start from the Local (C:)
(NOTE* openfolderproj is from a class,it is "C:/Users/"These forum:
https://www.qtcentre.org/threads/47359-i-am-unable-to-set-path-in-QFileSystemModel
https://forum.qt.io/topic/13985/i-am-unable-to-set-path-in-qfilesystemmodel
I dont understand,thats why i made a new forum.Please help me with whole code,thanks alot =)
-
@ELEMENTICY said in Set Path doesnt work ~ QFileSystemModel:
i did all,but it still start from the Local (C:)
(NOTE* openfolderproj is from a class,it is "C:/Users/"Because
setRootPath
does not change the (visible) root directory of your model.
(stated in your first linked thread as well as here in the Qt documentation)