mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-26 12:39:59 +01:00
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:
@@ -28,6 +28,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QAbstractTextDocumentLayout>
|
#include <QAbstractTextDocumentLayout>
|
||||||
#include <QGraphicsSimpleTextItem>
|
#include <QGraphicsSimpleTextItem>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
ElementPictureFactory* ElementPictureFactory::m_factory = nullptr;
|
ElementPictureFactory* ElementPictureFactory::m_factory = nullptr;
|
||||||
|
|
||||||
@@ -568,11 +569,11 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
|||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
||||||
for (QString style : styles) {
|
for (QString style : styles) {
|
||||||
if (rx.exactMatch(style)) {
|
if (rx==QRegularExpression(style)) {
|
||||||
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") pen.setStyle(Qt::DashLine);
|
if (style_value == "dashed") pen.setStyle(Qt::DashLine);
|
||||||
else if (style_value == "dotted") pen.setStyle(Qt::DotLine);
|
else if (style_value == "dotted") pen.setStyle(Qt::DotLine);
|
||||||
|
|||||||
Reference in New Issue
Block a user