From a2ca6f8a7e69aee5486aca067056ef57a24b6400 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Fri, 10 May 2024 14:28:51 +0200 Subject: [PATCH] tableview: Remove toggle selection on corner widget click On Qt 6.7.0 a wrong signal is connected meaning we get an exception trying to disconnect the selectAll slot (QTBUG-124267). Still even that fixed the implementation has changed such that it is using explicit disconnect in the widget's destructor (using explicit stored established QObject::Connection) so it will fail there. Out of abundance of caution simply remove the behavior override. --- Orange/widgets/data/utils/tableview.py | 17 ----------------- .../widgets/data/utils/tests/test_tableview.py | 11 ----------- 2 files changed, 28 deletions(-) diff --git a/Orange/widgets/data/utils/tableview.py b/Orange/widgets/data/utils/tableview.py index f9c467ffd54..af19f03c475 100644 --- a/Orange/widgets/data/utils/tableview.py +++ b/Orange/widgets/data/utils/tableview.py @@ -62,8 +62,6 @@ def __init__(self, *args, **kwargs): self.__cornerButton = btn = self.findChild(QAbstractButton) self.__cornerButtonFilter = DataTableView.__CornerPainter(self) btn.installEventFilter(self.__cornerButtonFilter) - btn.clicked.disconnect(self.selectAll) - btn.clicked.connect(self.cornerButtonClicked) if sys.platform == "darwin": btn.setAttribute(Qt.WA_MacSmallSize) @@ -86,21 +84,6 @@ def cornerText(self): """Return the corner text.""" return self.__cornerText - def cornerButtonClicked(self): - model = self.model() - selection = self.selectionModel() - selection = selection.selection() - if len(selection) == 1: - srange = selection[0] - if srange.top() == 0 and srange.left() == 0 \ - and srange.right() == model.columnCount() - 1 \ - and srange.bottom() == model.rowCount() - 1: - self.clearSelection() - else: - self.selectAll() - else: - self.selectAll() - def source_model(model: QAbstractItemModel) -> Optional[QAbstractItemModel]: while isinstance(model, QAbstractProxyModel): diff --git a/Orange/widgets/data/utils/tests/test_tableview.py b/Orange/widgets/data/utils/tests/test_tableview.py index 110cbb7264c..8323aa06c6e 100644 --- a/Orange/widgets/data/utils/tests/test_tableview.py +++ b/Orange/widgets/data/utils/tests/test_tableview.py @@ -44,17 +44,6 @@ def test_tableview_empty_model(self): RichTableModel.Icon) view.grab() - def test_tableview_toggle_select_all(self): - view = RichTableView() - model = RichTableModel(self.data) - view.setModel(model) - b = view.findChild(QAbstractButton) - b.click() - self.assertEqual(len(view.selectionModel().selectedRows(0)), - model.rowCount()) - b.click() - self.assertEqual(len(view.selectionModel().selectedRows(0)), 0) - def test_selection(self): view = RichTableView() model = RichTableModel(self.data)