diff --git a/gui_app.py b/gui_app.py index 8d36eb1..e079d06 100644 --- a/gui_app.py +++ b/gui_app.py @@ -953,6 +953,7 @@ class MainWindow(QMainWindow): # 重新应用筛选和高亮(保持原有的筛选状态) if has_search_filter: + self._suppress_filter_clear_once = True self.filter_table(self.table_search_input.text()) elif has_status_filter: # 重新应用状态筛选(隐藏不匹配的行) @@ -1569,6 +1570,29 @@ class MainWindow(QMainWindow): def filter_table(self, text): """筛选表格行并高亮关键词""" keyword_raw = text.strip() + suppress_clear = getattr(self, "_suppress_filter_clear_once", False) + if suppress_clear: + self._suppress_filter_clear_once = False + # 如果先全选再进行筛选,先清空勾选,避免隐藏行仍保持勾选 + if (not suppress_clear and keyword_raw and hasattr(self, "table_select_all_checkbox") + and self.table_select_all_checkbox.isChecked()): + for config in self.configs: + config['勾选'] = False + self.table_select_all_checkbox.blockSignals(True) + self.table_select_all_checkbox.setChecked(False) + self.table_select_all_checkbox.blockSignals(False) + self._update_checked_count() + self._update_status_statistics() + # 同步当前页勾选框显示 + if not self.use_model_view and hasattr(self, "config_table"): + for row in range(self.config_table.rowCount()): + wrapper = self.config_table.cellWidget(row, 0) + if wrapper: + checkbox = wrapper.findChild(QCheckBox) + if checkbox: + checkbox.blockSignals(True) + checkbox.setChecked(False) + checkbox.blockSignals(False) if self.use_model_view: if not self.table_proxy: return