Replace QRegExp with QRegularExpression

Reviewers: kbasan, msutcliffe

Reviewed By: kbasan, msutcliffe

Subscribers: jenkins

Differential Revision: https://dev.swift-project.org/D11
This commit is contained in:
Mathew Sutcliffe
2017-05-05 22:35:25 +01:00
parent 94fbfeefdb
commit d5ab73e1bc
17 changed files with 55 additions and 54 deletions

View File

@@ -37,7 +37,7 @@
#include <QPlainTextEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QRegExp>
#include <QRegularExpression>
#include <QTabBar>
#include <QCompleter>
#include <Qt>
@@ -270,9 +270,9 @@ namespace BlackGui
flightPlan.setTakeoffTimePlanned(v);
}
static const QRegExp withUnit("\\D+");
thread_local const QRegularExpression withUnit("\\D+");
v = ui->le_CrusingAltitude->text().trimmed();
if (!v.isEmpty() && withUnit.indexIn(v) < 0)
if (!v.isEmpty() && !withUnit.match(v).hasMatch())
{
v += "ft";
ui->le_CrusingAltitude->setText(v);

View File

@@ -13,6 +13,8 @@
#include "blackmisc/logmessage.h"
#include "blackconfig/buildconfig.h"
#include <QRegularExpression>
using namespace BlackMisc;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::Simulation::FsCommon;
@@ -176,7 +178,7 @@ namespace BlackGui
const QString raw = rawString.trimmed();
if (raw.isEmpty()) { return QStringList(); }
QStringList dirs;
const QStringList rawLines = raw.split(QRegExp("\n|\r\n|\r"));
const QStringList rawLines = raw.split(QRegularExpression("\n|\r\n|\r"));
for (const QString &l : rawLines)
{
const QString normalized = CFileUtils::normalizeFilePathToQtStandard(l);

View File

@@ -229,10 +229,10 @@ namespace BlackGui
void CWeatherComponent::setupInputValidators()
{
QRegExp reIcaoOrLatitude("^[a-zA-Z]{4}|-?\\d{1,2}[,.]?\\d+$", Qt::CaseInsensitive);
ui->le_LatOrIcao->setValidator(new QRegExpValidator(reIcaoOrLatitude, this));
QRegExp reLongitude("^-?\\d{1,2}[,.]?\\d+$", Qt::CaseInsensitive);
ui->le_Lon->setValidator(new QRegExpValidator(reLongitude, this));
QRegularExpression reIcaoOrLatitude("^[a-zA-Z]{4}|-?\\d{1,2}[,.]?\\d+$", QRegularExpression::CaseInsensitiveOption);
ui->le_LatOrIcao->setValidator(new QRegularExpressionValidator(reIcaoOrLatitude, this));
QRegularExpression reLongitude("^-?\\d{1,2}[,.]?\\d+$", QRegularExpression::CaseInsensitiveOption);
ui->le_Lon->setValidator(new QRegularExpressionValidator(reLongitude, this));
}
void CWeatherComponent::setupCompleter()