(self, logical_index, _1, _2)
When resizing the widget when scrolled further down, the
        positions of rows changes. Obviously, the user resized in order to
        better see the row of interest. This keeps that row centered.
When resizing the widget when scrolled further down, the
        positions of rows changes. Obviously, the user resized in order to
        better see the row of interest. This keeps that row centered.
When resizing the widget when scrolled further down the positions of rows changes . Obviously the user resized in order to better see the row of interest . This keeps that row centered .
def keep_row_centered(self, logical_index, _1, _2):
        """When resizing the widget when scrolled further down, the
        positions of rows changes. Obviously, the user resized in order to
        better see the row of interest. This keeps that row centered."""
        # TODO: This does not work properly
        # Prevent function being exectued more than once per resize
        if logical_index is not self.model().Columns.DISTRIBUTION.index:
            return
        top_row = self.indexAt(self.rect().topLeft()).row()
        bottom_row = self.indexAt(self.rect().bottomLeft()).row()
        middle_row = top_row + (bottom_row - top_row) // 2
        self.scrollTo(self.model().index(middle_row, 0), QTableView.PositionAtCenter)
def keep_row_centered ( self , logical_index , _1 , _2 ) : # TODO: This does not work properly # Prevent function being exectued more than once per resize if logical_index is not self . model ( ) . Columns . DISTRIBUTION . index : return top_row = self . indexAt ( self . rect ( ) . topLeft ( ) ) . row ( ) bottom_row = self . indexAt ( self . rect ( ) . bottomLeft ( ) ) . row ( ) middle_row = top_row + ( bottom_row - top_row ) // 2 self . scrollTo ( self . model ( ) . index ( middle_row , 0 ) , QTableView . PositionAtCenter )