Re: Problem with TreeModelFilter and editable columns



On Thu, 2007-02-01 at 14:37 +0100, Dingeman wrote:
> I ran into a strange problem with when I use a filtered tree model and
> editable columns: when I edit the data in row X of the filtered data
> set, the data in row X of the /unfiltered/ data set is updated (which is
> usually not the same row :-().
> 
> I have reduced the code to a minimum and attached this below. Does
> anyone have any ideas on what is going wrong?

Yes, confirmed.

The problem is that
_auto_store_on_cellrenderer_toggle_edited_with_model() signal handler
would need to recognise that a child model is involved, and in that case
convert from the filtered path that it gets via the signal to the child
path, using Gtk::TreeModelFilter::convert_path_to_child_path():
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeModelFilter.html#f5f71bebaca37e385f20b3c00b215fab

But what if it's a GtkTreeModelSort instead. Then it would need to call 
Gtk::TreeModelSort::convert_path_to_child_path() instead.

I guess we could maybe do some dynamic-casting here, and then do the
right thing.

Could you please file a bug for this, with the test case as a single
compile-able .cc file.

Until it's fixed (if it can be fixed) you'll have to use append_column()
and handle the signal manually, instead of using the
append_column_editable() convenience function. There's more about doing
that here, under "Implementing custom logic for editable cells":
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch08s02.html#id2525430


-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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