How to remove the sort arrow of a GtkTreeView?
I need to remove the sort arrow from the column header. This can be done by calling set_sort_indicator(false)
on a column.
The arrow does not appear, but the space for it still seems to be conserved. If the column header is large enough to fill the entire header, the last part is truncated (where the arrow should be).
Is there a way to make the title fill the entire title?
On GTK +, this is a bit weird. I have downloaded and read the relevant parts of the GtkTreeViewColumn code and it seems to be using this logic:
if (tree_column->show_sort_indicator ||
(GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0))
gtk_widget_show (arrow);
else
gtk_widget_hide (arrow);
Where arrow
is the arrow widget. This seems to indicate that the arrow widget is always wrapped in a horizontal box that makes up the column header, and then just hidden (not removed) if it shouldn't be visible. This would mean it is still in the drawer, taking up space and causing the shortcut to clip.
I would recommend looking in the GTK + bugtracker for the problem, and if none are found, build one.
a source to share
Ok, you can use the method set_clickable
on a column if you don't want it to have an arrow
then use signal_connect
to signal clicked
and bind it to a function that will use get_sort_column_id
to get the current sort order and then apply the reverse sort order with set_sort_column_id
.
a source to share