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?

+1


a source to share


3 answers


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.

0


a source


Ok, so I have submitted a bug report to gtk. They said this was not a problem and would not be fixed.



I've looked at other graphical tools (windows, qt) and their implementation is different, but it doesn't seem to matter to the guys at the gtk team.

0


a source


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

.

0


a source







All Articles