From 9034d8d79140d38a2989916c831f2d14a9005c04 Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Sat, 3 Oct 2020 15:40:32 +0200 Subject: [PATCH] QT6: Fix deprecated QRegExp --- .../ElementsCollection/elementslocation.cpp | 66 +++++++++++++------ 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index 2a074bc58..e1fb167c0 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -144,11 +144,23 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const */ QString ElementsLocation::baseName() const { - QRegExp regexp("^.*([^/]+)\\.elmt$"); - if (regexp.exactMatch(m_collection_path)) { - return(regexp.capturedTexts().at(1)); + QRegularExpression regexp("^.*(?[^/]+)\\.elmt$"); + if (!regexp.isValid()) + { + qWarning() <<"this is an error in the code" + << regexp.errorString() + << regexp.patternErrorOffset(); + return QString(); } - return(QString()); + + QRegularExpressionMatch match = regexp.match(m_collection_path); + if (!match.hasMatch()) + { + qDebug()<<"no Match => return" + < return" - <[a-z]+://.*)/.*$"); + if (!re.isValid()) + { + qWarning() + < return" + <