summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Roden-Corrent <ryan@rcorre.net>2020-11-27 09:14:06 -0500
committerRyan Roden-Corrent <ryan@rcorre.net>2020-11-27 09:36:02 -0500
commitb651662763b1cfd6fcacd643281b72387b39a5aa (patch)
tree09ff609ba8c3b8eb858ef83009dbec96965baad6
parent6a9f3d6cf55d7863b9b650aece2ab081e46bfc61 (diff)
downloadqutebrowser-b651662763b1cfd6fcacd643281b72387b39a5aa.tar.gz
qutebrowser-b651662763b1cfd6fcacd643281b72387b39a5aa.zip
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.
-rw-r--r--qutebrowser/completion/models/listcategory.py6
1 files 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)