Re: [Java-gnome-developer] Updating sorted TreeModel
Brought to you by:
afcowie
From: Przemyslaw W. <pw...@o2...> - 2008-12-11 10:53:54
|
Andrew Cowie wrote: > On Wed, 2008-12-10 at 16:03 +0100, Przemyslaw Wesolek wrote: >> I'm having troubles updating TreeModel, which is sorted: whenever I >> update a value in the column by which the model (view?) is sorted, the >> re-ordering happens and I have no guarantee that all the rows will be >> iterated over. Moreover, some rows may be iterated more than once. > > So this might fall into the category of "putting the wrong TreeModel in > the TreeView"? > > If you're using a TreeModelSort to wrap a ListStore, you put the > TreeModelSort into the TreeView. That's right, works smoothly. To summarize: 1) Create your model 2) Create TreeModelSort wrapping your model 3) Connect wrapping model to the view 4) Propagate your model changes on the underlying model > [at least, I've had no problem with it; I did have a case once where the > data displayed in the TreeView would wobble a bit as I was updating all > the rows because the sorting values were not unique, and so it sometimes > flip-flopped a bit when confronted with equal values] This is not a big problem for me; my first idea was to synchronize on Gdk.lock before changing the model, maybe this would help (if TreeView is updated in main loop)? > Anyway, if you're still stuck you'll need to show us your code (more to > the point, to boil your problem down to code that someone can > comprehend, or better yet, if it's really a bug, write a TestCase that > can go into the test suite). For sure it is the case you described. Hm, hard to say if it is a bug or not... For me, it is API and reality incompatibility (i.e. iterating over the model misses some rows). Thanks a lot, Przemek |