Hello,

I have a tree view displaying a QFileSystemModel, and I need to highlight a specific file in the tree. But since QFileSystemModel is loading the children asynchronously, using selectionModel()->setCurrentIndex() seems to be failing, unless the path has been previously expanded in the tree by the user.

Can anyone recommend a way of selecting a file in QFileSystemModel tree view? The only way I can think of is to manually parse the path, call expand() on the tree nodes, wait until QFileSystemModel fetches the directory (how?) and after the entire path is expanded, call selectionModel()->setCurrentIndex(). Isn't there an easier way?

Thanks!