refactor: Settings make the name checking regex static in the method
This commit is contained in:
parent
4df7c54afb
commit
204a6cca8a
1 changed files with 2 additions and 1 deletions
|
|
@ -155,7 +155,8 @@ QVariant Settings::defaultValue(const QString &key)
|
||||||
// The localhost name can contain spaces and non word characters
|
// The localhost name can contain spaces and non word characters
|
||||||
QString name = QSysInfo::machineHostName().simplified();
|
QString name = QSysInfo::machineHostName().simplified();
|
||||||
name.replace(QLatin1String(" "), QStringLiteral("_"));
|
name.replace(QLatin1String(" "), QStringLiteral("_"));
|
||||||
name.replace(QRegularExpression(QLatin1String("\\W")), QLatin1String(""));
|
static const auto nameRegex = QRegularExpression(QLatin1String("\\W"));
|
||||||
|
name.replace(nameRegex, QLatin1String(""));
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue