Skip to content

Commit

Permalink
Fix clearing filter selections in column filters (#2850)
Browse files Browse the repository at this point in the history
  • Loading branch information
PiispaH authored Jun 17, 2024
1 parent 02fb8c2 commit 8b5120c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spinetoolbox/spine_db_editor/widgets/custom_qtableview.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,19 @@ def populate_context_menu(self):
self._menu.addAction("Filter by", self.filter_by_selection)
self._menu.addAction("Filter excluding", self.filter_excluding_selection)
self._menu.addSeparator()
self._menu.addAction("Clear all filters", self._spine_db_editor.clear_all_filters)
self._menu.addAction("Clear all filters", self._clear_filters)
self._menu.addSeparator()
# Shortcuts
remove_rows_action.setShortcut(QKeySequence(Qt.Modifier.CTRL.value | Qt.Key.Key_Delete.value))
remove_rows_action.setShortcutContext(Qt.WidgetShortcut)
self.addAction(remove_rows_action)

def _clear_filters(self):
"""Clear all filters"""
self._spine_db_editor.clear_all_filters()
for i in range(self._EXPECTED_COLUMN_COUNT):
self.model().get_auto_filter_menu(i)._clear_filter()

def contextMenuEvent(self, event):
"""Shows context menu.
Expand Down

0 comments on commit 8b5120c

Please sign in to comment.