Fix deprecated QRegExp

Use QRegularExpression instead.

https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users

This function was introduced in Qt 5
This commit is contained in:
Simon De Backer
2020-09-18 23:04:59 +02:00
parent 7fb4033ece
commit 93055c6a96

View File

@@ -19,6 +19,8 @@
#include "elementscene.h" #include "elementscene.h"
#include "QPropertyUndoCommand/qpropertyundocommand.h" #include "QPropertyUndoCommand/qpropertyundocommand.h"
#include <QRegularExpression>
/** /**
@brief CustomElementGraphicPart::CustomElementGraphicPart @brief CustomElementGraphicPart::CustomElementGraphicPart
Default constructor. Default constructor.
@@ -518,12 +520,12 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
#endif #endif
//Check each pair of style //Check each pair of style
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
foreach (QString style, styles) foreach (QString style, styles)
{ {
if (!rx.exactMatch(style)) continue; if (rx!=QRegularExpression(style)) continue;
QString style_name = rx.cap(1); QString style_name = rx.namedCaptureGroups().at(1);
QString style_value = rx.cap(2); QString style_value = rx.namedCaptureGroups().at(2);
if (style_name == "line-style") if (style_name == "line-style")
{ {
if (style_value == "dashed") _linestyle = DashedStyle; if (style_value == "dashed") _linestyle = DashedStyle;