Mod: replace QRegExp with QRegularExpression
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
#ifndef _PreComp_
|
||||
# include <QCheckBox>
|
||||
# include <QDialogButtonBox>
|
||||
# include <QRegExp>
|
||||
# include <QRegExpValidator>
|
||||
# include <QRegularExpression>
|
||||
# include <QRegularExpressionValidator>
|
||||
# include <QVBoxLayout>
|
||||
# include <Interface_Static.hxx>
|
||||
#endif
|
||||
@@ -148,13 +148,13 @@ DlgExportHeaderStep::DlgExportHeaderStep(QWidget* parent)
|
||||
|
||||
ui->lineEditProduct->setReadOnly(true);
|
||||
|
||||
QRegExp rx;
|
||||
QRegularExpression rx;
|
||||
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
||||
QRegExpValidator* companyValidator = new QRegExpValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegExp(rx);
|
||||
QRegularExpressionValidator* companyValidator = new QRegularExpressionValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegularExpression(rx);
|
||||
ui->lineEditCompany->setValidator(companyValidator);
|
||||
QRegExpValidator* authorValidator = new QRegExpValidator(ui->lineEditAuthor);
|
||||
authorValidator->setRegExp(rx);
|
||||
QRegularExpressionValidator* authorValidator = new QRegularExpressionValidator(ui->lineEditAuthor);
|
||||
authorValidator->setRegularExpression(rx);
|
||||
ui->lineEditAuthor->setValidator(authorValidator);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QButtonGroup>
|
||||
# include <QRegExp>
|
||||
# include <QRegExpValidator>
|
||||
# include <QRegularExpression>
|
||||
# include <QRegularExpressionValidator>
|
||||
# include <QVBoxLayout>
|
||||
# include <Interface_Static.hxx>
|
||||
#endif
|
||||
@@ -98,13 +98,13 @@ DlgImportExportIges::DlgImportExportIges(QWidget* parent)
|
||||
bg->addButton(ui->radioButtonBRepOff, 0);
|
||||
bg->addButton(ui->radioButtonBRepOn, 1);
|
||||
|
||||
QRegExp rx;
|
||||
QRegularExpression rx;
|
||||
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
||||
QRegExpValidator* companyValidator = new QRegExpValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegExp(rx);
|
||||
QRegularExpressionValidator* companyValidator = new QRegularExpressionValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegularExpression(rx);
|
||||
ui->lineEditCompany->setValidator(companyValidator);
|
||||
QRegExpValidator* authorValidator = new QRegExpValidator(ui->lineEditAuthor);
|
||||
authorValidator->setRegExp(rx);
|
||||
QRegularExpressionValidator* authorValidator = new QRegularExpressionValidator(ui->lineEditAuthor);
|
||||
authorValidator->setRegularExpression(rx);
|
||||
ui->lineEditAuthor->setValidator(authorValidator);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
# include <cfloat>
|
||||
# include <QMessageBox>
|
||||
# include <QRegExp>
|
||||
# include <QRegularExpression>
|
||||
# include <QTreeWidget>
|
||||
#endif
|
||||
|
||||
@@ -142,7 +142,7 @@ bool Mirroring::accept()
|
||||
activeDoc->openTransaction("Mirroring");
|
||||
|
||||
QString shape, label;
|
||||
QRegExp rx(QString::fromLatin1(" \\(Mirror #\\d+\\)$"));
|
||||
QRegularExpression rx(QString::fromLatin1(" \\(Mirror #\\d+\\)$"));
|
||||
QList<QTreeWidgetItem *> items = ui->shapes->selectedItems();
|
||||
float normx=0, normy=0, normz=0;
|
||||
int index = ui->comboBox->currentIndex();
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
# include <QMessageBox>
|
||||
# include <QRegExp>
|
||||
# include <QRegularExpression>
|
||||
# include <QRegularExpressionMatch>
|
||||
# include <Standard_Failure.hxx>
|
||||
#endif
|
||||
|
||||
@@ -616,34 +617,43 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx)
|
||||
} else {
|
||||
// TODO: check validity of the text that was entered: Does subElement actually reference to an element on the obj?
|
||||
|
||||
// We must expect that "text" is the translation of "Face", "Edge" or "Vertex" followed by an ID.
|
||||
QRegExp rx;
|
||||
std::stringstream ss;
|
||||
auto getSubshapeName = [](const QString& part) -> std::string {
|
||||
// We must expect that "text" is the translation of "Face", "Edge" or "Vertex" followed by an ID.
|
||||
QRegularExpression rx;
|
||||
QRegularExpressionMatch match;
|
||||
std::stringstream ss;
|
||||
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Face") + QString::fromLatin1("(\\d+)$"));
|
||||
if (parts[1].indexOf(rx) >= 0) {
|
||||
int faceId = rx.cap(1).toInt();
|
||||
ss << "Face" << faceId;
|
||||
} else {
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Edge") + QString::fromLatin1("(\\d+)$"));
|
||||
if (parts[1].indexOf(rx) >= 0) {
|
||||
int lineId = rx.cap(1).toInt();
|
||||
ss << "Edge" << lineId;
|
||||
} else {
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Vertex") + QString::fromLatin1("(\\d+)$"));
|
||||
if (parts[1].indexOf(rx) >= 0) {
|
||||
int vertexId = rx.cap(1).toInt();
|
||||
ss << "Vertex" << vertexId;
|
||||
} else {
|
||||
//none of Edge/Vertex/Face. May be empty string.
|
||||
//Feed in whatever user supplied, even if invalid.
|
||||
ss << parts[1].toLatin1().constData();
|
||||
}
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Face") + QString::fromLatin1("(\\d+)$"));
|
||||
if (part.indexOf(rx, 0, &match) >= 0) {
|
||||
int faceId = match.captured(1).toInt();
|
||||
ss << "Face" << faceId;
|
||||
return ss.str();
|
||||
}
|
||||
}
|
||||
|
||||
line->setProperty("RefName", QByteArray(ss.str().c_str()));
|
||||
subElement = ss.str();
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Edge") + QString::fromLatin1("(\\d+)$"));
|
||||
if (part.indexOf(rx, 0, &match) >= 0) {
|
||||
int lineId = match.captured(1).toInt();
|
||||
ss << "Edge" << lineId;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Vertex") + QString::fromLatin1("(\\d+)$"));
|
||||
if (part.indexOf(rx, 0, &match) >= 0) {
|
||||
int vertexId = match.captured(1).toInt();
|
||||
ss << "Vertex" << vertexId;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
//none of Edge/Vertex/Face. May be empty string.
|
||||
//Feed in whatever user supplied, even if invalid.
|
||||
ss << part.toLatin1().constData();
|
||||
return ss.str();
|
||||
};
|
||||
|
||||
auto name = getSubshapeName(parts[1]);
|
||||
|
||||
line->setProperty("RefName", QByteArray(name.c_str()));
|
||||
subElement = name;
|
||||
}
|
||||
|
||||
Part::AttachExtension* pcAttach = ViewProvider->getObject()->getExtensionByType<Part::AttachExtension>();
|
||||
|
||||
Reference in New Issue
Block a user