I want to restore the expanding of a TreeView.

What would be the easiest approach?
I'm thinking of something like, iterating through all QModelIndexes of the first column and storing the expanding flag of this Modelindex.

Then I refill the tree and set the expanding settings to the same items, but only with the knowledge of the row and column number...

what do you think?