From b651662763b1cfd6fcacd643281b72387b39a5aa Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Fri, 27 Nov 2020 09:14:06 -0500 Subject: Use QRegularExpression instead of QRegExp. The latter is deprecated. See: https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users Fixes #5909. Note: The docs say: > QRegExp by default does Unicode-aware matching, while > QRegularExpression requires a separate option; see below for more > details. I don't think we need this option, as it only influences character classes, which we aren't using here: https://doc.qt.io/qt-5/qregularexpression.html#PatternOption-enum > The meaning of the \w, \d, etc., character classes, as well as the > meaning of their counterparts (\W, \D, etc.), is changed from matching > ASCII characters only to matching any character with the corresponding > Unicode property. --- qutebrowser/completion/models/listcategory.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qutebrowser/completion/models/listcategory.py b/qutebrowser/completion/models/listcategory.py index 79dc0770a..d4193b6d8 100644 --- a/qutebrowser/completion/models/listcategory.py +++ b/qutebrowser/completion/models/listcategory.py @@ -22,7 +22,7 @@ import re from typing import Iterable, Tuple -from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp +from PyQt5.QtCore import QSortFilterProxyModel, QRegularExpression from PyQt5.QtGui import QStandardItem, QStandardItemModel from PyQt5.QtWidgets import QWidget @@ -63,9 +63,9 @@ class ListCategory(QSortFilterProxyModel): val = re.sub(r' +', r' ', val) # See #1919 val = re.escape(val) val = val.replace(r'\ ', '.*') - rx = QRegExp(val, Qt.CaseInsensitive) + rx = QRegularExpression(val, QRegularExpression.CaseInsensitiveOption) qtutils.ensure_valid(rx) - self.setFilterRegExp(rx) + self.setFilterRegularExpression(rx) self.invalidate() sortcol = 0 self.sort(sortcol) -- cgit v1.2.3-54-g00ecf