Re: a TreeModel that's sortable and filterable?
- From: Armin Burgmeier <armin arbur net>
- To: Joaquim Schmidlap <schmidlap schmidlap org>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: a TreeModel that's sortable and filterable?
- Date: Sat, 14 Jun 2008 22:12:49 +0200
On Fri, 2008-06-13 at 18:13 -0500, Joaquim Schmidlap wrote:
> It looks like TreeModelFilter and TreeModelSort are separate
> derivations from TreeModel...pity.
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).
> If I wanted a TreeModel to be sortable and filterable, what's the
> best way forward? I assume I'd have to pick one and add the
> functionality of the other myself, or perhaps do something with
> multiple inheritance. What is recommended here? What's easiest?
>
> And, I realize this calls for speculation, but can anyone say why
> this design decision was made? Seems like what I want to do would be
> relatively common.
Armin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]