Expand gtkmm GtkTreeView column
-
08-06-2021 - |
Question
Im looking forward to expand one of my gtkmm treeview columns so it would use all the space left, and shrink other columns... Its there any way to do this?
m_ScrolledWindow.add(m_TreeView);
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
m_refTreeModel = Gtk::ListStore::create(m_Columns);
m_TreeView.set_model(m_refTreeModel);
m_TreeView.append_column("ID", m_Columns.m_col_id);
m_TreeView.append_column("Task", m_Columns.m_col_task);
/// I WANT TO EXPAND TASK COLUMN
m_TreeView.append_column("Time", m_Columns.m_col_time);
m_TreeView.append_column("Date", m_Columns.m_col_date);
Solution
EDIT: I was wrong, see correct way below (works in my code)
You would need to do this:
m_TreeView.get_column(1)->set_expand(true);
(replace '1' with actual position counting from 0 and left to right)
Note: This just makes column 'n' take up all free space. It won't hide any other columns.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow