Using the same model in two treeview and prevent selecting the same item?



Hello,

I have a list which I want to display in two treeviews and prevent
selecting the same item in both.

The idea is that the user selects an item in the first list, then the
second list is shown, and it should not contain the item selected in
the first list (or the item should be inactive or whatever).

I tried using a model filter to this end. It has an option to set
custom filter callback and in this callback I fetch the selection of
the first list (if any) and return false if the filtered item is the
same as selected.

The problem is that I have to call refilter whenever the selection
changes in the first list. Otherwise, the second list contains
everything from the model. Since the second list is hidden in my
application I could call refilter on showing it but a more dynamic
solution that allows showing both lists would be welcome.

O course, my list of about dozen items can be refiltered on every
selection change just fine but it does not look like the right
solution.

I could possibly use a filter column in the list but setting it would
be tedious. AFAIK the selection change signal only gives current
selection so I would have to save the previous selection so that I
could flip the filter column on both. I am not sure that it would
resolve the automatic update issue either.

Thanks

Michal



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]