Better validate point label.
--HG-- branch : develop
This commit is contained in:
parent
7c6bfb14a3
commit
f613074f9f
|
@ -194,7 +194,7 @@ void Calculator::InitCharacterSets()
|
||||||
|
|
||||||
// Defining identifier character sets
|
// Defining identifier character sets
|
||||||
DefineNameChars(QStringLiteral("0123456789_") + symbols.join(""));
|
DefineNameChars(QStringLiteral("0123456789_") + symbols.join(""));
|
||||||
DefineOprtChars(symbols.join("") + QStringLiteral("+-*^/?<>=#!$%&|~'_"));
|
DefineOprtChars(symbols.join("") + QStringLiteral("+-*^/?<>=#!$%&|~_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -732,7 +732,10 @@ void DialogTool::NamePointChanged()
|
||||||
{
|
{
|
||||||
QString name = edit->text();
|
QString name = edit->text();
|
||||||
name.replace(" ", "");
|
name.replace(" ", "");
|
||||||
if (name.isEmpty() || (pointName != name && data->IsUnique(name) == false))
|
QRegExpValidator v(QRegExp(nameRegExp), this);
|
||||||
|
int pos = 0;
|
||||||
|
if (name.isEmpty() || (pointName != name && data->IsUnique(name) == false) ||
|
||||||
|
v.validate(name, pos) == QValidator::Invalid)
|
||||||
{
|
{
|
||||||
flagName = false;
|
flagName = false;
|
||||||
ChangeColor(labelEditNamePoint, Qt::red);
|
ChangeColor(labelEditNamePoint, Qt::red);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
//Same regexp in pattern.xsd shema file. Don't forget synchronize.
|
//Same regexp in pattern.xsd shema file. Don't forget synchronize.
|
||||||
const QString nameRegExp = QStringLiteral("^([^0-9-*/^+=\\s\\(\\)%:;!.,]){1,1}([^-*/^+=\\s\\(\\)%:;!.,]){0,}$");
|
const QString nameRegExp = QStringLiteral("^([^0-9-*/^+=\\s\\(\\)%:;!.,`'\"]){1,1}([^-*/^+=\\s\\(\\)%:;!.,`'\"]){0,}$");
|
||||||
|
|
||||||
// From documantation: If you use QStringLiteral you should avoid declaring the same literal in multiple places: This
|
// From documantation: If you use QStringLiteral you should avoid declaring the same literal in multiple places: This
|
||||||
// furthermore blows up the binary sizes.
|
// furthermore blows up the binary sizes.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user