From 02f86ec352ab4db654150749dd170d92d17d5d75 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Mon, 17 May 2021 18:33:59 +0200 Subject: [PATCH] Make failed sort column change a no-op The previous behaviour when a non-sortable column was clicked was to trigger the sorting routine, which was usually a no-op, but would reorder rows if the configured sort column was hidden. --- qt/aqt/browser/table/table.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/qt/aqt/browser/table/table.py b/qt/aqt/browser/table/table.py index 64fac9c96..90570561f 100644 --- a/qt/aqt/browser/table/table.py +++ b/qt/aqt/browser/table/table.py @@ -358,15 +358,14 @@ class Table: self._scroll_to_column(self._model.len_columns() - 1) def _on_sort_column_changed(self, section: int, order: int) -> None: - order = bool(order) column = self._model.column_at_section(section) if column.sorting == Columns.SORTING_NONE: showInfo(tr.browsing_sorting_on_this_column_is_not()) - sort_key = self._state.sort_column - else: - sort_key = column.key - if self._state.sort_column != sort_key: - self._state.sort_column = sort_key + self._set_sort_indicator() + return + order = bool(order) + if self._state.sort_column != column.key: + self._state.sort_column = column.key # default to descending for non-text fields if column.sorting == Columns.SORTING_REVERSED: order = not order