Mod: replace QRegExp with QRegularExpression

This commit is contained in:
wmayer
2022-10-07 14:03:53 +02:00
parent c4f2a81317
commit 840fc70106
14 changed files with 107 additions and 85 deletions

View File

@@ -26,7 +26,8 @@
#ifndef _PreComp_
# include <QContextMenuEvent>
# include <QMenu>
# include <QRegExp>
# include <QRegularExpression>
# include <QRegularExpressionMatch>
# include <QShortcut>
# include <QString>
# include <QImage>
@@ -360,11 +361,12 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
std::string shapetype(msg.pSubName);
// if-else edge vertex
if (shapetype.size() > 4 && shapetype.substr(0,4) == "Edge") {
QRegExp rx(QString::fromLatin1("^Edge(\\d+)$"));
int pos = expr.indexOf(rx);
if (pos > -1) {
QRegularExpression rx(QString::fromLatin1("^Edge(\\d+)$"));
QRegularExpressionMatch match;
expr.indexOf(rx, 0, &match);
if (match.hasMatch()) {
bool ok;
int ElementId = rx.cap(1).toInt(&ok) - 1;
int ElementId = match.captured(1).toInt(&ok) - 1;
if (ok) {
int countItems = ui->listWidgetElements->count();
for (int i=0; i < countItems; i++) {
@@ -379,11 +381,12 @@ void TaskSketcherElements::onSelectionChanged(const Gui::SelectionChanges& msg)
}
}
else if (shapetype.size() > 6 && shapetype.substr(0,6) == "Vertex"){
QRegExp rx(QString::fromLatin1("^Vertex(\\d+)$"));
int pos = expr.indexOf(rx);
if (pos > -1) {
QRegularExpression rx(QString::fromLatin1("^Vertex(\\d+)$"));
QRegularExpressionMatch match;
expr.indexOf(rx, 0, &match);
if (match.hasMatch()) {
bool ok;
int ElementId = rx.cap(1).toInt(&ok) - 1;
int ElementId = match.captured(1).toInt(&ok) - 1;
if (ok) {
// Get the GeoID&Pos
int GeoId;