Re: Sorting a TreeModel



On 1/11/07, Murray Cumming <murrayc murrayc com> wrote:
On Wed, 2007-01-10 at 12:20 -0800, Joe Van Dyk wrote:
> In my TreeModel, I have a bunch of floats.  When these floats are
> displayed in the TreeView, they should be rounded to two or three
> decimal places.  You should be able to sort on those columns as well.
>
> The TreeModel can contain about to 1000 rows or so, each row has 30
> columns.  About half of those columns contain these floats.  The
> TreeModel is updated at least once a second.  So, performance might be
> an issue.
[snip]

The TreeView::append_column_numeric() and
TreeView::append_column_numeric_editable() convenience functions:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeView.html#e6fc0051cc178bfacea2dec27c2d5a58

allow you to specify a printf-style format, though you can do this
yourself with a set_cell_data_func() callback. The formatting would only
happen for visible columns, not all columns, so it shouldn't be a
performance problem. Then again, updating once a second is quite
unusual.

Wow, that's really useful.  Thanks.

I thought I heard a while back that when you're doing a lot of updates
to a TreeModel, that you should freeze it somehow for performance
reasons (something to do with iterators and references or something, I
forgot the specifics).  I have an update function that gets called
every second or so that updates every column in every row of the
TreeModel.

1.  Would using freeze_child_notify() be helpful here?
2.  Any other performance tips?



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