RegExp for validation label name.
--HG-- branch : feature
This commit is contained in:
parent
483c7a0e56
commit
4c913f485d
|
@ -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(nameRegExp, data, ui->tableWidgetIncrement);
|
||||||
TextDelegate *textDelegate = new TextDelegate("^([^0-9-*/^+=\\s\\(\\)%:;!.,]){1,1}([^-*/^+=\\s\\(\\)%:;!.,]){0,}$",
|
|
||||||
data, ui->tableWidgetIncrement);
|
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name
|
ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name
|
||||||
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
|
DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement);
|
||||||
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value
|
ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include <QString>
|
#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.
|
// Keep synchronize all names with initialization in VApllication class.
|
||||||
//measurements
|
//measurements
|
||||||
const QString headGirth_M = QStringLiteral("head_girth");
|
const QString headGirth_M = QStringLiteral("head_girth");
|
||||||
|
|
|
@ -43,6 +43,8 @@ static const quint32 null_id = 0;
|
||||||
#define DefPointRadius 2.0//mm
|
#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.
|
#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 SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
|
||||||
enum class Tool : unsigned char
|
enum class Tool : unsigned char
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,9 +95,7 @@ VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObjec
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractTool::~VAbstractTool()
|
VAbstractTool::~VAbstractTool()
|
||||||
{
|
{}
|
||||||
delete vis;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -84,6 +84,7 @@ private:
|
||||||
|
|
||||||
bool eventFilter(QObject* object, QEvent* event);
|
bool eventFilter(QObject* object, QEvent* event);
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(GraphicsViewZoom)
|
||||||
/** @brief _numScheduledScalings keep number scheduled scalings. */
|
/** @brief _numScheduledScalings keep number scheduled scalings. */
|
||||||
qint32 _numScheduledScalings;
|
qint32 _numScheduledScalings;
|
||||||
};
|
};
|
||||||
|
@ -121,6 +122,7 @@ protected:
|
||||||
void mousePressEvent(QMouseEvent *mousePress);
|
void mousePressEvent(QMouseEvent *mousePress);
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
private:
|
private:
|
||||||
|
Q_DISABLE_COPY(VMainGraphicsView)
|
||||||
GraphicsViewZoom* zoom;
|
GraphicsViewZoom* zoom;
|
||||||
bool showToolOptions;
|
bool showToolOptions;
|
||||||
};
|
};
|
||||||
|
|
|
@ -369,7 +369,8 @@ void VToolOptionsPropertyBrowser::SetPointName(const QString &name)
|
||||||
return;
|
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());
|
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user