diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index cf0d89bf6..1b256aff9 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -621,7 +621,11 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa //Get the couples style/value const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts); - QRegularExpression rx("^(?[a-z-]+):(?[a-zA-Z-]+)$"); + //Built once : this runs for every primitive of every element + //instance a project places, and recompiling the pattern each time + //was the single largest cost of opening a project. + static const QRegularExpression rx( + QStringLiteral("^(?[a-z-]+):(?[a-zA-Z-]+)$")); if (!rx.isValid()) { qWarning() <