diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index 1fe3d90c7..addbf8e85 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -241,20 +241,36 @@ void ElementsLocation::setPath(const QString &path) //The path start with project, we get the project and the path from the string else if (tmp_path.startsWith("project")) { - QRegExp rx("^project([0-9]+)\\+(embed:\\/\\/.*)$", Qt::CaseInsensitive); - if (rx.exactMatch(tmp_path)) + QRegularExpression re + ("^project(?[0-9])\\+(?embed://*.*)$"); + if (!re.isValid()) { - bool conv_ok; - uint project_id = rx.capturedTexts().at(1).toUInt(&conv_ok); - if (conv_ok) - { - QETProject *project = QETApp::project(project_id); - if (project) - { - m_collection_path = rx.capturedTexts().at(2); - m_project = project; - } - } + qWarning() <<"this is an error in the code" + << re.errorString() + << re.patternErrorOffset(); + return; + } + QRegularExpressionMatch match = re.match(tmp_path); + if (!match.hasMatch()) + { + qDebug()<<"no Match => return"; + return; + } + bool conv_ok; + uint project_id = match.captured("project_id").toUInt(&conv_ok); + if (!conv_ok) + { + qWarning()<<"toUint failed" + <