mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-02 01:54:13 +02:00
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:
committed by
Laurent Trinques
parent
fea4752a06
commit
62dc1e7c11
@@ -804,14 +804,15 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
|
|||||||
|
|
||||||
QString path_ = collectionPath(false);
|
QString path_ = collectionPath(false);
|
||||||
QRegularExpression rx("^(.*)/(.*\\.elmt)$");
|
QRegularExpression rx("^(.*)/(.*\\.elmt)$");
|
||||||
|
QRegularExpressionMatch match = rx.match(path_);
|
||||||
|
|
||||||
if (rx.exactMatch(path_))
|
if (match.hasMatch())
|
||||||
{
|
{
|
||||||
return project()
|
return project()
|
||||||
->embeddedElementCollection()
|
->embeddedElementCollection()
|
||||||
->addElementDefinition(
|
->addElementDefinition(
|
||||||
rx.cap(1),
|
match.captured(1),
|
||||||
rx.cap(2),
|
match.captured(2),
|
||||||
xml_document.documentElement());
|
xml_document.documentElement());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user