forked from qt-creator/qt-creator
Utils: Replace some QRegExp to QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: I7d12992506bbe33306c0ab750f73c7db1626abc3 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "qmloutputparser.h"
|
||||
#include "qmldebugconstants.h"
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace QmlDebug {
|
||||
|
||||
@@ -78,11 +78,12 @@ void QmlOutputParser::processOutput(const QString &output)
|
||||
if (status.startsWith(waitingForConnection)) {
|
||||
status.remove(0, waitingForConnection.size()); // chop of 'Waiting for connection '
|
||||
|
||||
static QRegExp waitingTcp(
|
||||
static QRegularExpression waitingTcp(
|
||||
QString::fromLatin1(Constants::STR_ON_PORT_PATTERN));
|
||||
if (waitingTcp.indexIn(status) > -1) {
|
||||
const QRegularExpressionMatch match = waitingTcp.match(status);
|
||||
if (match.hasMatch()) {
|
||||
bool canConvert;
|
||||
quint16 port = waitingTcp.cap(1).toUShort(&canConvert);
|
||||
quint16 port = match.captured(1).toUShort(&canConvert);
|
||||
if (canConvert)
|
||||
emit waitingForConnectionOnPort(Utils::Port(port));
|
||||
continue;
|
||||
|
@@ -424,13 +424,13 @@ bool ConsoleProcess::start()
|
||||
const QStringList fixedEnvironment = [env] {
|
||||
QStringList envStrings = env;
|
||||
// add PATH if necessary (for DLL loading)
|
||||
if (envStrings.filter(QRegExp(QLatin1String("^PATH="),Qt::CaseInsensitive)).isEmpty()) {
|
||||
if (envStrings.filter(QRegularExpression("^PATH=.*", QRegularExpression::CaseInsensitiveOption)).isEmpty()) {
|
||||
QByteArray path = qgetenv("PATH");
|
||||
if (!path.isEmpty())
|
||||
envStrings.prepend(QString::fromLatin1("PATH=%1").arg(QString::fromLocal8Bit(path)));
|
||||
}
|
||||
// add systemroot if needed
|
||||
if (envStrings.filter(QRegExp(QLatin1String("^SystemRoot="),Qt::CaseInsensitive)).isEmpty()) {
|
||||
if (envStrings.filter(QRegularExpression("^SystemRoot=.*", QRegularExpression::CaseInsensitiveOption)).isEmpty()) {
|
||||
QByteArray systemRoot = qgetenv("SystemRoot");
|
||||
if (!systemRoot.isEmpty())
|
||||
envStrings.prepend(QString::fromLatin1("SystemRoot=%1").arg(QString::fromLocal8Bit(systemRoot)));
|
||||
|
@@ -37,7 +37,6 @@
|
||||
#include <QPair>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPointer>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QTextCursor>
|
||||
|
||||
|
@@ -36,7 +36,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPlainTextEdit;
|
||||
class QRegExp;
|
||||
class QRegularExpressionMatch;
|
||||
class QTextCharFormat;
|
||||
class QTextCursor;
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QDateTime>
|
||||
#include <QTextStream>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QRect>
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
@@ -59,11 +59,12 @@ static QString rectangleToString(const QRect &r)
|
||||
|
||||
static QRect stringToRectangle(const QString &v)
|
||||
{
|
||||
static QRegExp pattern(QLatin1String("(\\d+)x(\\d+)([-+]\\d+)([-+]\\d+)"));
|
||||
static QRegularExpression pattern("^(\\d+)x(\\d+)([-+]\\d+)([-+]\\d+)$");
|
||||
Q_ASSERT(pattern.isValid());
|
||||
return pattern.exactMatch(v) ?
|
||||
QRect(QPoint(pattern.cap(3).toInt(), pattern.cap(4).toInt()),
|
||||
QSize(pattern.cap(1).toInt(), pattern.cap(2).toInt())) :
|
||||
const QRegularExpressionMatch match = pattern.match(v);
|
||||
return match.hasMatch() ?
|
||||
QRect(QPoint(match.captured(3).toInt(), match.captured(4).toInt()),
|
||||
QSize(match.captured(1).toInt(), match.captured(2).toInt())) :
|
||||
QRect();
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QRegExp>
|
||||
|
||||
namespace {
|
||||
|
||||
|
Reference in New Issue
Block a user