sortinggtkgtktreeview

How do I sort a GtkTreeModelFilter?


I have a GtkListStore with a GtkTreeModelFilter wrapped around this, to filter out certain rows. I then put this filter inside a GtkTreeView.

This causes my GtkTreeView to be not-sortable, as GtkTreeModelFilter does not implement GtkTreeSortable.

How do I make it so I can still sort the rows in my GtkTreeView?


Solution

  • The easiest way to do this is to wrap a GtkTreeModelSort around your GtkTreeModelFilter. Then add this wrapper to the GtkTreeView.

    In summary, you would have a GtkListStore inside a GtkTreeModelFilter inside a GtkTreeModelSort inside a GtkTreeView.