[solved] Why rowCount() of QFileSystemModel always return 0
While reading "this":http://qt-project.org/doc/qt-4.8/model-view-programming.html#using-model-indexes I tried to code the example.
@QFileSystemModel *model = new QFileSystemModel;
QModelIndex parent_index = model->index(QDir::currentPath());
int num_rows = model->rowCount(parent_index);@
But num_rows always give me 0.
Kindly request your guidance.
QFileSystemModel's loading is done asynchronously you have to at least wait for the directoryLoaded signal to be emitted before checking that kind for thing
Thank you SGaist it solved my issue.
"QFileSystemModel uses a separate thread to populate itself so it will not cause the main thread to hang as the file system is being queried. Calls to rowCount() will return 0 until the model populates a directory."
I should read document first.