Fix deprecated QRegExp

Use QRegularExpression instead.

https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users

This function was introduced in Qt 5
This commit is contained in:
Simon De Backer
2020-09-18 23:05:37 +02:00
parent 3eca82baad
commit 4c54335301

View File

@@ -33,14 +33,14 @@
#include "projectview.h"
#include "elementpicturefactory.h"
#include "aboutqetdialog.h"
#include "factory/elementfactory.h"
#include <cstdlib>
#include <iostream>
#define QUOTE(x) STRINGIFY(x)
#define STRINGIFY(x) #x
#include <QProcessEnvironment>
#include "factory/elementfactory.h"
#include <QRegularExpression>
#include <KAutoSaveFile>
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
@@ -911,7 +911,7 @@ QStringList QETApp::handledFileExtensions()
if (!ext.count()) {
ext << "qet";
ext << "elmt";
ext << QString(TITLEBLOCKS_FILE_EXTENSION).remove(QRegExp("^\\."));
ext << QString(TITLEBLOCKS_FILE_EXTENSION).remove(QRegularExpression("^\\."));
}
return(ext);
}
@@ -2102,10 +2102,10 @@ template <class T> void QETApp::addWindowsListToMenu(
or -1 if none could be found.
*/
int QETApp::projectIdFromString(const QString &url) {
QRegExp embedded("^project([0-9]+)\\+embed.*$", Qt::CaseInsensitive);
if (embedded.exactMatch(url)) {
QRegularExpression embedded("^project([0-9]+)\\+embed.*$", QRegularExpression::CaseInsensitiveOption);
if (embedded==QRegularExpression(url)) {
bool conv_ok = false;
int project_id = embedded.capturedTexts().at(1).toInt(&conv_ok);
int project_id = embedded.namedCaptureGroups().at(1).toInt(&conv_ok);
if (conv_ok) {
return(project_id);
}