RegExp for validation label name.

--HG--
branch : feature
This commit is contained in:
dismine 2014-09-04 16:42:16 +03:00
parent 483c7a0e56
commit 4c913f485d
6 changed files with 11 additions and 7 deletions

View File

@ -69,9 +69,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
}
}
//Same regex in pattern.xsd shema file. Don't forget synchronize.
TextDelegate *textDelegate = new TextDelegate("^([^0-9-*/^+=\\s\\(\\)%:;!.,]){1,1}([^-*/^+=\\s\\(\\)%:;!.,]){0,}$",
data, ui->tableWidgetIncrement);
TextDelegate *textDelegate = new TextDelegate(nameRegExp, data, ui->tableWidgetIncrement);
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value

View File

@ -29,6 +29,9 @@
#include "options.h"
#include <QString>
//Same regexp in pattern.xsd shema file. Don't forget synchronize.
const QString nameRegExp = QStringLiteral("^([^0-9-*/^+=\\s\\(\\)%:;!.,]){1,1}([^-*/^+=\\s\\(\\)%:;!.,]){0,}$");
// Keep synchronize all names with initialization in VApllication class.
//measurements
const QString headGirth_M = QStringLiteral("head_girth");

View File

@ -43,6 +43,8 @@ static const quint32 null_id = 0;
#define DefPointRadius 2.0//mm
#define NULL_ID null_id//use this value for initialization variables that keeps id values. 0 mean uknown id value.
extern const QString nameRegExp;
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
enum class Tool : unsigned char
{

View File

@ -95,9 +95,7 @@ VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObjec
//---------------------------------------------------------------------------------------------------------------------
VAbstractTool::~VAbstractTool()
{
delete vis;
}
{}
//---------------------------------------------------------------------------------------------------------------------
/**

View File

@ -84,6 +84,7 @@ private:
bool eventFilter(QObject* object, QEvent* event);
private:
Q_DISABLE_COPY(GraphicsViewZoom)
/** @brief _numScheduledScalings keep number scheduled scalings. */
qint32 _numScheduledScalings;
};
@ -121,6 +122,7 @@ protected:
void mousePressEvent(QMouseEvent *mousePress);
void mouseReleaseEvent(QMouseEvent *event);
private:
Q_DISABLE_COPY(VMainGraphicsView)
GraphicsViewZoom* zoom;
bool showToolOptions;
};

View File

@ -369,7 +369,8 @@ void VToolOptionsPropertyBrowser::SetPointName(const QString &name)
return;
}
if (name.isEmpty() || VContainer::IsUnique(name) == false)
QRegExp rx(nameRegExp);
if (name.isEmpty() || VContainer::IsUnique(name) == false || rx.exactMatch(name) == false)
{
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
}