I'm using Qt5. The code is really simple and goes like this:
struct DirEdit {
QLineEdit *lineedit;
QToolButton *button;
QListView *view;
QString dirPath;
QFileSystemModel dirModel;
bool ready {false};
};
Then in the source file:
for (std::size_t i = 0; i != c_lanes; ++i) {
dirEdits[i].view->setModel(&dirEdits[i].dirModel);
dirEdits[i].dirModel.setFilter(QDir::Files);
dirEdits[i].dirModel.setProperty(fIdProp, (uint)i);
}
and then finally when the user chooses a path to display the contents of in a QListView
:
DirEdit& de = dirEdits[folderId];
de.dirPath = selectedDirPath;
de.lineedit->setText(selectedDirPath);
de.dirModel.setRootPath(selectedDirPath);
de.view->setRootIndex(de.dirModel.setRootPath(selectedDirPath));
Now when I select /home/srsly
(the home folder, this being on a Fedora 25 Linux system), the current folder, where the program is being ran from, gets appended to the beginning of the list. The filters are set to exclude directories as you can see. What can be the reason for this strange behavior?