aboutsummaryrefslogtreecommitdiffstats
path: root/examples/opengl
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-03 18:12:01 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-06 22:07:21 +0200
commit735d8097489f836f32f65b8ff47f3e904642faf4 (patch)
tree42a5ae3ba757eb0b8686f0c3f98b5123f45d3b57 /examples/opengl
parentfa1a682cfdc0238a7ca10ffd45ea5f6ada4c8e7e (diff)
Port some examples from QRegExp to QRegularExpression
QRegExp is deprecated. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I5c5dc4965a03fbd1a3370be3fa9e64c5df6a9fd8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/grabber.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/opengl/grabber.py b/examples/opengl/grabber.py
index d4b625718..4c8f9a0d2 100644
--- a/examples/opengl/grabber.py
+++ b/examples/opengl/grabber.py
@@ -414,11 +414,13 @@ class MainWindow(QtWidgets.QMainWindow):
if not ok:
return QtCore.QSize()
- regExp = QtCore.QRegExp("([0-9]+) *x *([0-9]+)")
+ regExp = QtCore.QRegularExpression("([0-9]+) *x *([0-9]+)")
+ assert regExp.isValid()
- if regExp.exactMatch(text):
- width = int(regExp.cap(1))
- height = int(regExp.cap(2))
+ match = regExp.match(text)
+ if match.hasMatch():
+ width = int(match.captured(1))
+ height = int(match.captured(2))
if width > 0 and width < 2048 and height > 0 and height < 2048:
return QtCore.QSize(width, height)