Re: [gtkmm] Modifying a TreeRow with a TreeIter



Michael Babcock wrote:
How do modify a TreeRow if I have a TreeIter? TreeIter::operator* returns a const TreeRow reference.


I had a function:

void update_row (Gtk::TreeRow& row);

that I couldn't pass a dereferenced TreeIter to (because it was const).

To answer my own question, you _can_ modify a tree row with a const TreeRow. TreeRow::operator[] and TreeRow::set_value are const member functions even though they modify the tree row data. So you can and must make the TreeRow reference const. I was thinking the TreeRow object represented the tree row data, when it is really just another iterator.

--
Michael Babcock
Jim Henson's Creature Shop





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