Figured it out. The problem was that I was trying to make a selection on the `QTreeView` before the the specified directory had finished being loaded. In other words, tryng to make the selection within the method where I was changing directories.
The solution is to listen for the `directoryLoaded(QString)` `SIGNAL` that `QFileSystemModel` emits.
void QFileSystemModel::directoryLoaded ( const QString & path ) [signal]
This signal is emitted when the gatherer thread has finished to load the path.
This function was introduced in Qt 4.7.
connect(dirmodel,
this,
SLOT(model_directoryLoaded
(QString)));
connect(dirmodel,
SIGNAL(directoryLoaded(QString)),
this,
SLOT(model_directoryLoaded(QString)));
To copy to clipboard, switch view to plain text mode
Bookmarks