Solved Incorrect order on QTreeView with QFileSystemModel
-
Hello. I have QTreeView with QFileSystemModel. Files and directories on tree are in alphabetical order by default. If I open file/directory from directory not opened or not expanded before and select element on tree by setCurrentIndex(), that file is first on tree (of course in correct directory). The problem exists on Windows, on MacOS everything is OK.
Example:
-
Ok, I've resolved it by change:
pFileSystemModel->setRootPath(QDir::rootPath());
to
pFileSystemModel->setRootPath("");