Re: [gtkmm] Using TreeModelSort



Meier, Elke, ISO22 wrote:
> Assuming my_columns is defined and my_store is a standard Gtk::ListStore (or
> Gtk::TreeStore),
> just do
> 
>   my_store = Gtk::ListStore::create(my_columns);
>   my_store->set_sort_column_id(my_columns.whatever, Gtk::SORT_ASCENDING);
> 
> to get it sorted.
> 
> Hope that helps,

It already helped me a lot, thank you very much! :-)

However, I'm still having a problem with newly inserted, and then changed,
rows.

In my ColumnRecord, I have an invisible column containing a reference to the
object displayed in the TreeView. This one is my sorting column, and I have
written a SlotCompare function defining whether an object instance is "greater"
than another one, depending on some of the object's properties. I connected it
with the TreeModelSort using set_sort_func and set_sort_column_id.

Everything works fine, also with freshly inserted rows, as long as I don't touch
the object after inserting.

If, however, I change the object's properties later, the ListStore does not realize
that the sorting sequence may have changed. Newly inserted rows stay where they
were at the beginning, no matter what I do with them later.

Question: Is there a way to enforce a resort on a TreeModelSort?

Thanks,

  Markus



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