Question

I need to remove the sorting arrow from a column header. This can be done by calling set_sort_indicator(false) on the column.

The arrow isn't displayed, but the space for it seems to still be reserved. If the title of the column is big enough to fill all the header, the last part is clipped (where the arrow should be).

Is there a way to make the title fill the whole header?

Was it helpful?

Solution

This seems to be a bit weird in GTK+. I downloaded and read through relevant parts of the GtkTreeViewColumn's code, and it seems to use 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 widget holding the arrow. This seems to indicate that the arrow widget is always packed into the horizontal box that makes up the column's header, and then just hidden (not removed) if it's not supposed to be visible. That will mean it's still there in the box, occupying space and causing the label to be clipped.

I'd recommend searching through the GTK+ bugtracker for an issue about this, and if none is found, create one.

OTHER TIPS

Ok, so I've submitted a bug report to gtk. They said that it is not an issue and it won't be fixed.

I've looked on other graphical toolkits (windows, qt) and their implementation is different, but this doesn't seem to matter to the guys in the gtk team.

Ok you can use set_clickable method to the the column you don't want it to have an arrow then use signal_connect to the clicked signal and bind it to a function which will use get_sort_column_id to get the current sort order then apply the reverse sort order using set_sort_column_id.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top