Fixed issue #299. Error when opening .val file.
--HG-- branch : release
This commit is contained in:
parent
f1d7caaba5
commit
1c1077a0e6
|
@ -712,11 +712,9 @@ void DialogTool::NamePointChanged()
|
|||
if (edit)
|
||||
{
|
||||
QString name = edit->text();
|
||||
name.replace(" ", "");
|
||||
QRegExpValidator v(QRegExp(nameRegExp), this);
|
||||
int pos = 0;
|
||||
QRegularExpression rx(nameRegExp);
|
||||
if (name.isEmpty() || (pointName != name && data->IsUnique(name) == false) ||
|
||||
v.validate(name, pos) == QValidator::Invalid)
|
||||
rx.match(name).hasMatch() == false)
|
||||
{
|
||||
flagName = false;
|
||||
ChangeColor(labelEditNamePoint, Qt::red);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <QStringList>
|
||||
|
||||
//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
|
||||
// furthermore blows up the binary sizes.
|
||||
|
|
|
@ -60,7 +60,7 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
|
|||
QLineEdit *editor = new QLineEdit(parent);
|
||||
editor->setLocale(parent->locale());
|
||||
//Same regex pattern in xsd file
|
||||
editor->setValidator( new QRegExpValidator(QRegExp(regex)) );
|
||||
editor->setValidator( new QRegularExpressionValidator(QRegularExpression(regex)) );
|
||||
connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor);
|
||||
return editor;
|
||||
}
|
||||
|
|
|
@ -431,8 +431,8 @@ void VToolOptionsPropertyBrowser::SetPointName(const QString &name)
|
|||
return;
|
||||
}
|
||||
|
||||
QRegExp rx(nameRegExp);
|
||||
if (name.isEmpty() || VContainer::IsUnique(name) == false || rx.exactMatch(name) == false)
|
||||
QRegularExpression rx(nameRegExp);
|
||||
if (name.isEmpty() || VContainer::IsUnique(name) == false || rx.match(name).hasMatch() == false)
|
||||
{
|
||||
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@
|
|||
</xs:element>
|
||||
<xs:simpleType name="shortName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="^([^0-9-*/^+=\s\(\)%:;!.,`'\"]){1,1}([^-*/^+=\s\(\)%:;!.,`'\"]){0,}$"/>
|
||||
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\"]){1,1}([^*/^+\-=\s()?%:;!.,`'\"]){0,}$"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="units">
|
||||
|
|
Loading…
Reference in New Issue
Block a user