summaryrefslogtreecommitdiffstats
path: root/examples/opengl/legacy/grabber/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl/legacy/grabber/mainwindow.cpp')
-rw-r--r--examples/opengl/legacy/grabber/mainwindow.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/opengl/legacy/grabber/mainwindow.cpp b/examples/opengl/legacy/grabber/mainwindow.cpp
index da022adcdf..6ea6a28051 100644
--- a/examples/opengl/legacy/grabber/mainwindow.cpp
+++ b/examples/opengl/legacy/grabber/mainwindow.cpp
@@ -203,10 +203,11 @@ QSize MainWindow::getSize()
if (!ok)
return QSize();
- QRegExp regExp(tr("([0-9]+) *x *([0-9]+)"));
- if (regExp.exactMatch(text)) {
- int width = regExp.cap(1).toInt();
- int height = regExp.cap(2).toInt();
+ QRegularExpression regExp(tr("^([0-9]+) *x *([0-9]+)$"));
+ QRegularExpressionMatch match = regExp.match(text);
+ if (match.hasMatch()) {
+ int width = match.captured(1).toInt();
+ int height = match.captured(2).toInt();
if (width > 0 && width < 2048 && height > 0 && height < 2048)
return QSize(width, height);
}