Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: invalidate chained filters correctly when data is updated #39

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Fix: Process modifications in quality error tree correctly when multiple filters are present

## [2.0.6] - 2024-01-05

- Fix: Show correct results when user processed filter is toggled with map extent filter active
Expand Down
4 changes: 2 additions & 2 deletions src/quality_result_gui/quality_error_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(
# Checkbox for filtering out user processed rows
self._filter_user_processed_model = FilterByShowUserProcessedProxyModel()
self._filter_user_processed_model.setSourceModel(self._filter_model)
self._base_model.filterable_data_changed.connect(
self._filter_model.filter_invalidated.connect(
self._filter_user_processed_model.invalidateFilter
)
self.dock_widget.show_user_processed_errors_check_box.toggled.connect(
Expand All @@ -117,7 +117,7 @@ def __init__(
# Checkbox for filtering out rows outside map extent
self._filter_map_extent_model = FilterByExtentProxyModel()
self._filter_map_extent_model.setSourceModel(self._filter_user_processed_model)
self._base_model.filterable_data_changed.connect(
self._filter_user_processed_model.filter_invalidated.connect(
self._filter_map_extent_model.invalidateFilter
)
self.dock_widget.filter_with_map_extent_check_box.toggled.connect(
Expand Down
6 changes: 6 additions & 0 deletions src/quality_result_gui/quality_errors_tree_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,16 @@ def data(


class AbstractFilterProxyModel(QSortFilterProxyModel):
filter_invalidated = pyqtSignal()

def __init__(self, parent: Optional[QObject] = None) -> None:
super().__init__(parent)
self.setFilterRole(Qt.UserRole)

def invalidateFilter(self) -> None: # noqa: N802 (qt override)
super().invalidateFilter()
self.filter_invalidated.emit()

def filterAcceptsRow( # noqa: N802 (qt override)
self, source_row: int, source_parent: QModelIndex
) -> bool:
Expand Down
Loading