Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, August 2006
Expansion state of tree models


Message 1 in thread

Hi all.

I have a tree view that displays different models depending 
on context. Switching is done by calling setModel().

This works, but switching from and to always leads to an
entirely collapsed view (i.e. tree items are not expanded
even if they were before).

While this is understandable given the implementation of
the expansion state in the view, it is undesirable in my case
and I wonder whether others have had the same problem and
whether there's some 'canonical' workaround.

I can think of at least two:

(a) have multiple views in a stacked widget, switch pages 
instead of calling setModel(),

(b) propagate the expansion state to the model and retrieve
it from there later.

Both do not sound overly convincing...

Anybody an idea?

Regards,
Andre'

--
 [ signature omitted ]