Alias field for tool Spline.
This commit is contained in:
parent
7fe316c876
commit
648d1f1897
|
@ -2012,6 +2012,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property)
|
|||
case 61: // AttrNotes
|
||||
SetNotes<VToolSpline>(property);
|
||||
break;
|
||||
case 62: // AttrAlias
|
||||
SetAlias<VToolSpline>(property);
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"Unknown property type. id = "<<id;
|
||||
break;
|
||||
|
@ -2812,6 +2815,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
|||
length2.Eval();
|
||||
AddPropertyFormula(tr("C2: length:"), length2, AttrLength2);
|
||||
|
||||
AddPropertyAlias(i, tr("Alias:"));
|
||||
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
|
||||
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
|
||||
AddPropertyApproximationScale(tr("Approximation scale:"), spl.GetApproximationScale());
|
||||
|
@ -3625,6 +3629,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
|
|||
idToProperty[AttrAScale]->setValue(valueApproximationScale);
|
||||
|
||||
idToProperty[AttrNotes]->setValue(i->GetNotes());
|
||||
|
||||
idToProperty[AttrAlias]->setValue(i->GetAliasSuffix());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -2557,6 +2557,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
|
|||
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
|
||||
initData.duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0'));
|
||||
initData.approximationScale = GetParametrDouble(domElement, AttrAScale, QChar('0'));
|
||||
initData.aliasSuffix = GetParametrEmptyString(domElement, AttrAlias);
|
||||
|
||||
VToolSpline *spl = VToolSpline::Create(initData);
|
||||
|
||||
|
|
|
@ -148,6 +148,8 @@ DialogSpline::DialogSpline(const VContainer *data, quint32 toolId, QWidget *pare
|
|||
connect(ui->pushButtonGrowLength1, &QPushButton::clicked, this, &DialogSpline::DeployLength1TextEdit);
|
||||
connect(ui->pushButtonGrowLength2, &QPushButton::clicked, this, &DialogSpline::DeployLength2TextEdit);
|
||||
|
||||
connect(ui->lineEditAlias, &QLineEdit::textEdited, this, &DialogSpline::ValidateAlias);
|
||||
|
||||
vis = new VisToolSpline(data);
|
||||
auto path = qobject_cast<VisToolSpline *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
|
@ -432,6 +434,25 @@ void DialogSpline::EvalLength2()
|
|||
Eval(formulaData, flagLength2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSpline::ValidateAlias()
|
||||
{
|
||||
VSpline spline = spl;
|
||||
spline.SetAliasSuffix(ui->lineEditAlias->text());
|
||||
if (not ui->lineEditAlias->text().isEmpty() && not data->IsUnique(spline.GetAlias()))
|
||||
{
|
||||
flagAlias = false;
|
||||
ChangeColor(ui->labelAlias, errorColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
flagAlias = true;
|
||||
ChangeColor(ui->labelAlias, OkColor(this));
|
||||
}
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VSpline DialogSpline::CurrentSpline() const
|
||||
{
|
||||
|
@ -458,6 +479,7 @@ VSpline DialogSpline::CurrentSpline() const
|
|||
spline.SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
|
||||
spline.SetPenStyle(GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine));
|
||||
spline.SetColor(GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack));
|
||||
spline.SetAliasSuffix(ui->lineEditAlias->text());
|
||||
|
||||
return spline;
|
||||
}
|
||||
|
@ -588,6 +610,9 @@ void DialogSpline::SetSpline(const VSpline &spline)
|
|||
ui->plainTextEditLength2F->setPlainText(length2F);
|
||||
ui->lineEditSplineName->setText(qApp->TrVars()->VarToUser(spl.name()));
|
||||
|
||||
ui->lineEditAlias->setText(spl.GetAliasSuffix());
|
||||
ValidateAlias();
|
||||
|
||||
auto path = qobject_cast<VisToolSpline *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
|
||||
|
|
|
@ -88,6 +88,8 @@ private slots:
|
|||
void EvalAngle2();
|
||||
void EvalLength1();
|
||||
void EvalLength2();
|
||||
|
||||
void ValidateAlias();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSpline)
|
||||
|
||||
|
@ -117,6 +119,7 @@ private:
|
|||
bool flagLength1;
|
||||
bool flagLength2;
|
||||
bool flagError;
|
||||
bool flagAlias{true};
|
||||
|
||||
const QSharedPointer<VPointF> GetP1() const;
|
||||
const QSharedPointer<VPointF> GetP4() const;
|
||||
|
@ -127,7 +130,7 @@ private:
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool DialogSpline::IsValid() const
|
||||
{
|
||||
return flagAngle1 && flagAngle2 && flagLength1 && flagLength2 && flagError;
|
||||
return flagAngle1 && flagAngle2 && flagLength1 && flagLength2 && flagError && flagAlias;
|
||||
}
|
||||
|
||||
#endif // DIALOGSPLINE_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>532</width>
|
||||
<height>452</height>
|
||||
<height>482</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -925,6 +925,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelAlias">
|
||||
<property name="text">
|
||||
<string>Alias:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEditAlias">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -227,6 +227,7 @@ VToolSpline *VToolSpline::Create(VToolSplineInitData &initData)
|
|||
spline->SetColor(initData.color);
|
||||
spline->SetPenStyle(initData.penStyle);
|
||||
spline->SetApproximationScale(initData.approximationScale);
|
||||
spline->SetAliasSuffix(initData.aliasSuffix);
|
||||
|
||||
return VToolSpline::Create(initData, spline);
|
||||
}
|
||||
|
@ -651,6 +652,7 @@ void VToolSpline::SetSplineAttributes(QDomElement &domElement, const VSpline &sp
|
|||
doc->SetAttribute(domElement, AttrPenStyle, spl.GetPenStyle());
|
||||
doc->SetAttribute(domElement, AttrAScale, spl.GetApproximationScale());
|
||||
doc->SetAttributeOrRemoveIf(domElement, AttrDuplicate, spl.GetDuplicate(), spl.GetDuplicate() <= 0);
|
||||
doc->SetAttributeOrRemoveIf(domElement, AttrAlias, spl.GetAliasSuffix(), spl.GetAliasSuffix().isEmpty());
|
||||
|
||||
if (domElement.hasAttribute(AttrKCurve))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user