Maybe you can populate the model in batches? I think you could use canFetchMore() && fetchMore() for the invalid model index.
One more problem:
Think how to avoid changing the header too often. You can always show a custom header instead of the default one.And rowCount() is calling for all top level items when I emit headerDataChanged() signal which leads to further delay in selecting item & changing header.
Bookmarks