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:34 +02:00
parent 46e96f0a67
commit 432e80cecb

View File

@ -18,7 +18,7 @@
#include "conductorproperties.h" #include "conductorproperties.h"
#include <QPainter> #include <QPainter>
#include <QMetaEnum> #include <QMetaEnum>
#include <QRegularExpression>
/** /**
Constructeur par defaut Constructeur par defaut
*/ */
@ -789,11 +789,12 @@ void ConductorProperties::readStyle(const QString &style_string) {
QStringList styles = style_string.split(";", Qt::SkipEmptyParts); QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
#endif #endif
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$"); QRegularExpression Rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
foreach (QString style_str, styles) { foreach (QString style_str, styles) {
if (rx.exactMatch(style_str)) { if (Rx==QRegularExpression(style_str)) {
QString style_name = rx.cap(1);
QString style_value = rx.cap(2); QString style_name = Rx.namedCaptureGroups().at(1);
QString style_value = Rx.namedCaptureGroups().at(2);
if (style_name == "line-style") { if (style_name == "line-style") {
if (style_value == "dashed") style = Qt::DashLine; if (style_value == "dashed") style = Qt::DashLine;
else if (style_value == "dashdotted") style = Qt::DashDotLine; else if (style_value == "dashdotted") style = Qt::DashDotLine;