Re: Problem with child rows on Treeviews



Hey Arthur:

Gtk::ListStore does NOT support children.  You need to use a
Gtk::TreeStore instead.

Bob Caryl

Arthur Maciel wrote:

> Hi there. I get the following compilation error when building a
> treeview application. If I remove the children rows [which means the
> lines that contain m_refTreeModel->append(row.children())] it compiles
> perfectly (but is not a TreeModel anymore):
>
> Error:
> ---------------------------------------------------------------------------------------------------
> application.cpp: In constructor `Example::Application::Application()':
> application.cpp:73: error: no matching function for call to
> `Gtk::ListStore::
>    append(const Gtk::TreeNodeChildren&)'
> /usr/include/gtkmm-2.4/gtkmm/liststore.h:173: error: candidates are:
>    Gtk::TreeIter Gtk::ListStore::append()
> application.cpp:77: error: no matching function for call to
> `Gtk::ListStore::
>    append(const Gtk::TreeNodeChildren&)'
> /usr/include/gtkmm-2.4/gtkmm/liststore.h:173: error: candidates are:
>    Gtk::TreeIter Gtk::ListStore::append()
> application.cpp:89: error: no matching function for call to
> `Gtk::ListStore::
>    append(const Gtk::TreeNodeChildren&)'
> /usr/include/gtkmm-2.4/gtkmm/liststore.h:173: error: candidates are:
>    Gtk::TreeIter Gtk::ListStore::append()
> make: ** [typical-application.o] Erro 1
> ---------------------------------------------------------------------------------------------------
>
>
> Code:
> ---------------------------------------------------------------------------------------------------
> //Fill the TreeView's model
>     Gtk::TreeModel::Row row = *(m_refTreeModel->append());
>     row[m_Columns.m_col_id] = 1;
>     row[m_Columns.m_col_name] = "Billy Bob";
>
>     Gtk::TreeModel::Row childrow =
> *(m_refTreeModel->append(row.children()));
>     childrow[m_Columns.m_col_id] = 11;
>     childrow[m_Columns.m_col_name] = "Billy Bob Junior";
>
>     childrow = *(m_refTreeModel->append(row.children()));
>     childrow[m_Columns.m_col_id] = 12;
>     childrow[m_Columns.m_col_name] = "Sue Bob";
>
>     row = *(m_refTreeModel->append());
>     row[m_Columns.m_col_id] = 2;
>     row[m_Columns.m_col_name] = "Joey Jojo";
>
>     row = *(m_refTreeModel->append());
>     row[m_Columns.m_col_id] = 3;
>     row[m_Columns.m_col_name] = "Rob McRoberts";
>
>     childrow = *(m_refTreeModel->append(row.children()));
>     childrow[m_Columns.m_col_id] = 31;
>     childrow[m_Columns.m_col_name] = "Xavier McRoberts";
> ---------------------------------------------------------------------------------------------------
>
>
> Any idea on that would be really useful.
> Thank you and have a Happy New Year.
>
> Arthur Maciel
>
>------------------------------------------------------------------------
>
>_______________________________________________
>gtkmm-list mailing list
>gtkmm-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtkmm-list
>  
>



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