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).
This commit is contained in:
scorpio810
2026-07-17 07:45:51 +00:00
committed by Laurent Trinques
parent fea4752a06
commit 62dc1e7c11
@@ -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