From 62dc1e7c112f3d11db88b06f8abb535904306298 Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Fri, 17 Jul 2026 07:45:51 +0000 Subject: [PATCH] Fix QRegularExpression API misuse in ElementsLocation::setXml (Qt6 path) The Qt6 branch of the #if QT_VERSION guard swapped QRegExp for QRegularExpression but kept calling QRegExp-only methods (exactMatch()/cap()), which QRegularExpression doesn't have. Use the correct QRegularExpression API instead: match() returns a QRegularExpressionMatch, tested with hasMatch() and read with captured(n). --- sources/ElementsCollection/elementslocation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index 9ab1506d2..ad9e23a9a 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -804,14 +804,15 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const QString path_ = collectionPath(false); QRegularExpression rx("^(.*)/(.*\\.elmt)$"); + QRegularExpressionMatch match = rx.match(path_); - if (rx.exactMatch(path_)) + if (match.hasMatch()) { return project() ->embeddedElementCollection() ->addElementDefinition( - rx.cap(1), - rx.cap(2), + match.captured(1), + match.captured(2), xml_document.documentElement()); } else