|FAQ Index - Search - Recent Changes - Everything - Add entry|
13.21. How do I get changes in my TreeModel to show up in my TreeView?
Whenever there are changes in your TreeModel, you need to emit a signal to notify the view of the change. Otherwise, your View content may become stale, in which case refreshing the View manually (via a resize or pointer movement) may show the new data. GenericTreeModel provides 4 methods for notifying the View of Model updates:
- row_changed() emits the "row-changed" signal. Call this when there are changes in the content of a row (node) in your model.
- row_deleted() emits the "row-deleted" signal. Call this when a row is deleted.
- row_has_child_toggled() emits the "row-has-child-toggled" signal. Call this after adding children to a childless row or removing all the children of a row.
- row_inserted() emits the "row-inserted" signal. Call this when a new row is inserted or appended to the model.
You can also emit the signals directly with the gtk.Object emit() method. See the TreeModel API reference for more info on these functions and signals: [developer.gnome.org]