Re: a TreeModel that's sortable and filterable?
- From: Jamf <jamf gm gmail com>
- To: Armin Burgmeier <armin arbur net>
- Cc: gtkmm-list gnome org
- Subject: Re: a TreeModel that's sortable and filterable?
- Date: Sun, 15 Jun 2008 11:33:27 +0200
Armin Burgmeier escribió:
TreeModelFilter and TreeModelSort have child models. So, if you have
some TreeModel A, and you want it sorted, then create a TreeModelSort
with A as child. If you want it both sorted and filtered, then create a
TreeModelFilter with a TreeModelSort as child (or vice versa).
Note that Gtk::ListStore and Gtk::TreeStore already support sorting
(since they implement Gtk::TreeSortable), so you don't even need
Gtk::TreeModelSort for them (unless you want to do things like showing a
sorted and an unsorted model in different views).
I have similar situation in my project.
If I put ListStore as the model in the treeview, then the sorting
properties work correctly, but when a TreeModelFilter (with the
liststore as child) is used as the model in the treeview, the
ListStore's sorting properties don't work and I get:
"Gtk-CRITICAL **: gtk_tree_sortable_get_sort_column_id: assertion
`GTK_IS_TREE_SORTABLE (sortable)' failed
Gtk-CRITICAL **: gtk_tree_sortable_has_default_sort_func: assertion
`GTK_IS_TREE_SORTABLE (sortable)' failed"
Then the only way to get sorting properties is creating a new
TreeModelSort with the TreeModelFilter as child.
Regards:
Juan Ángel Moreno Fernández
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]