mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-04-24 21:39:58 +02: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 <QAbstractTextDocumentLayout>
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
#include <QRegularExpression>
|
||||
|
||||
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")
|
||||
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||
#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) {
|
||||
if (rx.exactMatch(style)) {
|
||||
QString style_name = rx.cap(1);
|
||||
QString style_value = rx.cap(2);
|
||||
if (rx==QRegularExpression(style)) {
|
||||
QString style_name = rx.namedCaptureGroups().at(1);
|
||||
QString style_value = rx.namedCaptureGroups().at(2);
|
||||
if (style_name == "line-style") {
|
||||
if (style_value == "dashed") pen.setStyle(Qt::DashLine);
|
||||
else if (style_value == "dotted") pen.setStyle(Qt::DotLine);
|
||||
|
||||
Reference in New Issue
Block a user