Search code examples
c++model-view-controllergtkgtkmmgtktreeview

Gtk::TreeModel::iterator usage when implementing TreeModel


I am trying to implement own TreeModel for use in TreeView.

I have subclassed Gtk::TreeModel and currently trying to override virtual methods with my own implementation.

But i have a problem with very basics of it. Say, we have

virtual bool iter_next_vfunc(const iterator &iter, iterator &iter_next) const;

function where i am supposed to read iter variable, somehow understand where it points to and based on this, fill iter_next with point next to the current.

But i do not understand how to do this.

What is 'index', 'pointer' or whatever based on what i could understand where iter is pointing to?


Solution

  • Directly access the underlying GtkTreeIter struct through gobj(), and fill it with the relevant data ('stamp' should be the same across all iters of the same model). (Reference)