How-to map existing Gtk::TreeView columns to a ColumnRecord?
- From: Markus Kolb <markus kolb+gtkmm tower-net de>
- To: gtkmm Mailinglist <gtkmm-list gnome org>
- Subject: How-to map existing Gtk::TreeView columns to a ColumnRecord?
- Date: Sat, 28 Feb 2015 15:32:19 +0100
Hi again,
I've an existing TreeView with columns from a glade file.
I can add rows but the column values are not shown.
If I remove all columns and add them again in code (see commented code
below),
it works.
So somehow it seems, that the existing columns are not mapped
(correctly) to the new model.
I have not found a way to redefine the ColumnType.
Do I miss anything? What?
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns()
{
add(col_clientaddress);
add(col_clientport);
add(col_connectiontime);
add(col_buttondisconnect);
}
Gtk::TreeModelColumn<Glib::ustring> col_clientaddress;
Gtk::TreeModelColumn<guint> col_clientport;
Gtk::TreeModelColumn<Glib::ustring> col_connectiontime;
Gtk::TreeModelColumn<Gtk::ButtonsType> col_buttondisconnect;
} ;
ModelColumns m_cols;
Gtk::TreeView* m_p_treeview;
Glib::RefPtr<Gtk::ListStore> m_p_model;
m_p_model = Gtk::ListStore::create(m_cols);
// if I re-add the columns it works
// m_p_treeview->remove_all_columns();
// m_p_treeview->append_column(_("Client address"),
m_cols.col_clientaddress);
// m_p_treeview->append_column(_("Client port"),
m_cols.col_clientport);
// m_p_treeview->append_column(_("Connection time"),
m_cols.col_connectiontime);
// m_p_treeview->append_column(_("Disconnect"),
m_cols.col_buttondisconnect);
m_p_treeview->set_model(m_p_model);
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]