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 "qmloutputparser.h"
|
||||||
#include "qmldebugconstants.h"
|
#include "qmldebugconstants.h"
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
namespace QmlDebug {
|
namespace QmlDebug {
|
||||||
|
|
||||||
@@ -78,11 +78,12 @@ void QmlOutputParser::processOutput(const QString &output)
|
|||||||
if (status.startsWith(waitingForConnection)) {
|
if (status.startsWith(waitingForConnection)) {
|
||||||
status.remove(0, waitingForConnection.size()); // chop of 'Waiting for connection '
|
status.remove(0, waitingForConnection.size()); // chop of 'Waiting for connection '
|
||||||
|
|
||||||
static QRegExp waitingTcp(
|
static QRegularExpression waitingTcp(
|
||||||
QString::fromLatin1(Constants::STR_ON_PORT_PATTERN));
|
QString::fromLatin1(Constants::STR_ON_PORT_PATTERN));
|
||||||
if (waitingTcp.indexIn(status) > -1) {
|
const QRegularExpressionMatch match = waitingTcp.match(status);
|
||||||
|
if (match.hasMatch()) {
|
||||||
bool canConvert;
|
bool canConvert;
|
||||||
quint16 port = waitingTcp.cap(1).toUShort(&canConvert);
|
quint16 port = match.captured(1).toUShort(&canConvert);
|
||||||
if (canConvert)
|
if (canConvert)
|
||||||
emit waitingForConnectionOnPort(Utils::Port(port));
|
emit waitingForConnectionOnPort(Utils::Port(port));
|
||||||
continue;
|
continue;
|
||||||
|
@@ -424,13 +424,13 @@ bool ConsoleProcess::start()
|
|||||||
const QStringList fixedEnvironment = [env] {
|
const QStringList fixedEnvironment = [env] {
|
||||||
QStringList envStrings = env;
|
QStringList envStrings = env;
|
||||||
// add PATH if necessary (for DLL loading)
|
// 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");
|
QByteArray path = qgetenv("PATH");
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
envStrings.prepend(QString::fromLatin1("PATH=%1").arg(QString::fromLocal8Bit(path)));
|
envStrings.prepend(QString::fromLatin1("PATH=%1").arg(QString::fromLocal8Bit(path)));
|
||||||
}
|
}
|
||||||
// add systemroot if needed
|
// 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");
|
QByteArray systemRoot = qgetenv("SystemRoot");
|
||||||
if (!systemRoot.isEmpty())
|
if (!systemRoot.isEmpty())
|
||||||
envStrings.prepend(QString::fromLatin1("SystemRoot=%1").arg(QString::fromLocal8Bit(systemRoot)));
|
envStrings.prepend(QString::fromLatin1("SystemRoot=%1").arg(QString::fromLocal8Bit(systemRoot)));
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QRegularExpressionMatch>
|
#include <QRegularExpressionMatch>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
class QRegExp;
|
|
||||||
class QRegularExpressionMatch;
|
class QRegularExpressionMatch;
|
||||||
class QTextCharFormat;
|
class QTextCharFormat;
|
||||||
class QTextCursor;
|
class QTextCursor;
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
#ifdef QT_GUI_LIB
|
#ifdef QT_GUI_LIB
|
||||||
@@ -59,11 +59,12 @@ static QString rectangleToString(const QRect &r)
|
|||||||
|
|
||||||
static QRect stringToRectangle(const QString &v)
|
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());
|
Q_ASSERT(pattern.isValid());
|
||||||
return pattern.exactMatch(v) ?
|
const QRegularExpressionMatch match = pattern.match(v);
|
||||||
QRect(QPoint(pattern.cap(3).toInt(), pattern.cap(4).toInt()),
|
return match.hasMatch() ?
|
||||||
QSize(pattern.cap(1).toInt(), pattern.cap(2).toInt())) :
|
QRect(QPoint(match.captured(3).toInt(), match.captured(4).toInt()),
|
||||||
|
QSize(match.captured(1).toInt(), match.captured(2).toInt())) :
|
||||||
QRect();
|
QRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,6 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QRegExp>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user