[SOLVED] set path of QFileSystemModel
General and Desktop
6
Posts
2
Posters
2.7k
Views
1
Watching
-
i created a QFileSystemModel and a view
i tried this:
@fileSystemModel->setRootPath(QDir::homePath());@
but even this the view continue to show the root path (/) in the view
how to fix that? -
@
fileSystemModel = new QFileSystemModel(this);
ui->fileSystemView->setModel(this->fileSystemModel);
fileSystemModel->setRootPath(QDir::homePath());
ui->fileSystemView->setRootIndex(fileSystemModel->index(QDir::currentPath()));
@
now nothing is showing in the view at all, empty view! -
You are setting the model's root path to QDir::homePath() and the view's root index to the index of QDir::currentPath()
-
sorry, i'm new to that
what should i do exactly? -
Use homePath in both cases