I'm having dificulties getting all the values of a N levels QTreeWidget by the folloying order:

For example:

A1
B1
B2
B3
C1
C2
D1
D2
C3

and i want to put them in an array like: A1 B1 B2 B3 C1 C2 D1 D2 C3

I'm having big problems trying to find this algorithm. For a finit levels tree i can do it but for N its more dificult.

Someone can help me with this?

Maybe i can use the model for that?