QTreeView store expanded state - long ?
So I'm trying to store an expanded state of my custom qtreeView.
I did a simple model with 100k items. Each item has id.
And here I hit a wall. It seems that isExpanded(item->index()) is quite expensive call as it does a lot of (expandedIndexes.contains internally which I imagine might be expensive? . How else can I store the list ? or do the checks? Or how can I access diretly expandedIndexes from within tree? Then I can just store the list indexes data(Qt::UserRole) and state which would be a lot faster I think?
I'm only storing if the check == true,
Just thoguh I'd drop a "temporary" solution I'm testing now. I ended up extending qtreeView, and capturing expand/collapse signals. Then I generate a QSet with these ids that later I can store/restore via model()->match(id) idea. Not sure how well it will work in very large data sets, say 100k items and 10k expanded state items, But well see.