Re: Cast Gtk::TreeModel::iterator to int
- From: José Alburquerque <jaalburquerque cox net>
- To: Glus Xof <gtglus gmail com>
- Cc: Murray Cumming <murrayc murrayc com>, gtkmm-list gnome org
- Subject: Re: Cast Gtk::TreeModel::iterator to int
- Date: Tue, 01 Dec 2009 20:26:38 -0500
On Tue, 2009-12-01 at 21:55 +0100, Glus Xof wrote:
> 2009/12/1 Murray Cumming <murrayc murrayc com>:
> > On Mon, 2009-11-30 at 19:25 +0100, Glus Xof wrote:
> >> Hello guys,
> >>
> >> A very stupid question... (but I don't find the answer).
> >>
> >> Is it possible to cast a Gtk::TreeModel::iterator value to int (or gint) ???
> >
> > If that int should be a row number, then you can convert the iter to a
> > Gtk::TreeModel::Path.
> >
>
> Sorry Mr. Cumming, I don't reach to see for the moment what you
> suggest... I'd need the row number as an int (or gint) value, not as a
> Gtk::TreeModel::Path...
To get a row number from a path, use
Gtk::TreeModel::Path::get_indices(). It returns an array of the
components in the path, which can be stored in a standard container.
If the model is a ListStore, the first component of the path should be
the row number. If it is a TreeStore, the first component is also a row
in the model, but the next component represents the location of a child
row with respect to the parent, and so on.
--
José
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]