[SOLVED] set path of QFileSystemModel
-
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? -
Hi,
You have it in QFileSystemModel's documentation:
@tree->setRootIndex(model->index(QDir::currentPath()));@
-
@
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