From c7f7ad2869d8f958ccf82343232d42c8c1629d34 Mon Sep 17 00:00:00 2001 From: rozyczko Date: Thu, 21 Sep 2023 17:55:59 +0200 Subject: [PATCH 1/2] Qt6-ize the setFilterRegularExpression syntax --- src/sas/qtgui/MainWindow/DataExplorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sas/qtgui/MainWindow/DataExplorer.py b/src/sas/qtgui/MainWindow/DataExplorer.py index 93148b6efb..22269f719f 100644 --- a/src/sas/qtgui/MainWindow/DataExplorer.py +++ b/src/sas/qtgui/MainWindow/DataExplorer.py @@ -128,7 +128,7 @@ def __init__(self, parent=None, guimanager=None, manager=None): self.theory_model.itemChanged.connect(self.onFileListChanged) # Don't show "empty" rows with data objects - self.data_proxy.filterRegularExpression = "[^()]" + self.data_proxy.setFilterRegularExpression(QtCore.QRegularExpression(".+")) # Create a window to allow the display name to change self.nameChangeBox = ChangeName(self) From 0af91f7d77e4807cbf06f4f0f47aca3e9c4045c2 Mon Sep 17 00:00:00 2001 From: rozyczko Date: Thu, 21 Sep 2023 18:47:49 +0200 Subject: [PATCH 2/2] missed a few occurences --- src/sas/qtgui/MainWindow/CategoryManager.py | 5 +++-- src/sas/qtgui/MainWindow/DataExplorer.py | 2 +- src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sas/qtgui/MainWindow/CategoryManager.py b/src/sas/qtgui/MainWindow/CategoryManager.py index 8c64b01f3f..fa9ceabb5d 100644 --- a/src/sas/qtgui/MainWindow/CategoryManager.py +++ b/src/sas/qtgui/MainWindow/CategoryManager.py @@ -277,8 +277,9 @@ def onSearch(self): input_to_check = str(self.txtSearch.text()) # redefine the proxy model - self.model_proxy.filterRegularExpression = QtCore.QRegularExpression(input_to_check, - QtCore.Qt.CaseInsensitive, QtCore.QRegularExpression.FixedString) + self.model_proxy.setFilterRegularExpression(QtCore.QRegularExpression(input_to_check, + QtCore.QRegularExpression.CaseInsensitiveOption | + QtCore.QRegularExpression.PatternOption.NoPatternOption)) def onModify(self): """ diff --git a/src/sas/qtgui/MainWindow/DataExplorer.py b/src/sas/qtgui/MainWindow/DataExplorer.py index 22269f719f..a17ad61540 100644 --- a/src/sas/qtgui/MainWindow/DataExplorer.py +++ b/src/sas/qtgui/MainWindow/DataExplorer.py @@ -141,7 +141,7 @@ def __init__(self, parent=None, guimanager=None, manager=None): self.theory_proxy.setSourceModel(self.theory_model) # Don't show "empty" rows with data objects - self.theory_proxy.filterRegularExpression = "[^()]" + self.theory_proxy.setFilterRegularExpression(QtCore.QRegularExpression(".+")) # Theory model view self.freezeView.setModel(self.theory_proxy) diff --git a/src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py b/src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py index 40b8243439..751f498ccc 100644 --- a/src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py +++ b/src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py @@ -110,7 +110,7 @@ def testDefaults(self, form): assert form.model.columnCount() == 0 assert isinstance(form.data_proxy, QSortFilterProxyModel) assert form.data_proxy.sourceModel() == form.model - assert "[^()]" == str(form.data_proxy.filterRegExp().pattern()) + assert ".+" == str(form.data_proxy.filterRegExp().pattern()) assert isinstance(form.treeView, QTreeView) # Models - theory @@ -121,7 +121,7 @@ def testDefaults(self, form): assert form.theory_model.columnCount() == 0 assert isinstance(form.theory_proxy, QSortFilterProxyModel) assert form.theory_proxy.sourceModel() == form.theory_model - assert "[^()]" == str(form.theory_proxy.filterRegExp().pattern()) + assert ".+" == str(form.theory_proxy.filterRegExp().pattern()) assert isinstance(form.freezeView, QTreeView) def testWidgets(self, form):