Whenever I click on a header of a column or emit the changed
signal on ColumnView.sorter
in code, the ColumnView
automatically scrolls so that some of the rows that were previously visible are kept in view (or at least I think this is the logic). This behavior is more annoying than useful in my use case, so I would like to turn it off or bypass it in some way.
Some containers are subclass of Gtk.Viewport
, which has a scroll_to_focus
property that seems to allow to control this behavior. ColumnView
however does not have it. I tried searching through Gtk source code to find how the behavior is implemented but was unsuccessful.
As a workaround I now store the ColumnView.vadjustment
in a ColumnView.sorter.changed
signal handler and schedule it to be restored with idle_add()
some time after the sorting is completed. This however causes the view to scroll to the wrong place for a split second before vadjustment is restored.