From 6864374f05c7493be2c18079e3777483d480ac6e Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 21 Jan 2017 01:00:40 +0100 Subject: Example: migrate grabber to use QRegularExpression Update the legacy grabber example to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: I1d1871b7e82cdb214fdd8ad55a606d5e7682fab1 Reviewed-by: Sze Howe Koh --- examples/opengl/legacy/grabber/mainwindow.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/opengl/legacy/grabber/mainwindow.cpp') 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); } -- cgit v1.2.3