Refactoring.

Use a static QRegularExpression object to avoid recreating the regular expressions.
This commit is contained in:
Roman Telezhynskyi 2024-04-17 13:05:42 +03:00
parent f1081a2aad
commit 5199f4d4bc

View File

@ -1149,8 +1149,9 @@ void VDomDocument::SetLabelTemplate(QDomElement &element, const QVector<VLabelTe
//---------------------------------------------------------------------------------------------------------------------
void VDomDocument::ValidateVersion(const QString &version)
{
const QRegularExpression rx(QStringLiteral("^([0-9]|[1-9][0-9]|[1-2][0-5][0-5]).([0-9]|[1-9][0-9]|[1-2][0-5][0-5])"
".([0-9]|[1-9][0-9]|[1-2][0-5][0-5])$"));
static const QRegularExpression rx(
QStringLiteral("^([0-9]|[1-9][0-9]|[1-2][0-5][0-5]).([0-9]|[1-9][0-9]|[1-2][0-5][0-5])"
".([0-9]|[1-9][0-9]|[1-2][0-5][0-5])$"));
if (!rx.match(version).hasMatch())
{