Alias field for tool Cubic Bezier Path.
This commit is contained in:
parent
38e60d5905
commit
7fe316c876
|
@ -2134,6 +2134,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VPE::VProperty *
|
|||
case 61: // AttrNotes
|
||||
SetNotes<VToolCubicBezierPath>(property);
|
||||
break;
|
||||
case 62: // AttrAlias
|
||||
SetAlias<VToolCubicBezierPath>(property);
|
||||
break;
|
||||
default:
|
||||
qWarning()<<"Unknown property type. id = "<<id;
|
||||
break;
|
||||
|
@ -2856,6 +2859,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCubicBezierPath(QGraphicsItem *
|
|||
formView->setTitle(tr("Tool cubic bezier curve"));
|
||||
|
||||
AddPropertyObjectName(i, tr("Name:"), true);
|
||||
AddPropertyAlias(i, tr("Alias:"));
|
||||
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
|
||||
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
|
||||
AddPropertyApproximationScale(tr("Approximation scale:"), i->getSplinePath().GetApproximationScale());
|
||||
|
@ -3705,6 +3709,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
|
|||
idToProperty[AttrAScale]->setValue(valueApproximationScale);
|
||||
|
||||
idToProperty[AttrNotes]->setValue(i->GetNotes());
|
||||
|
||||
idToProperty[AttrAlias]->setValue(i->GetAliasSuffix());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -2830,6 +2830,7 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
|
|||
const QString penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
|
||||
const quint32 duplicate = GetParametrUInt(domElement, AttrDuplicate, QChar('0'));
|
||||
const qreal approximationScale = GetParametrDouble(domElement, AttrAScale, QChar('0'));
|
||||
const QString alias = GetParametrEmptyString(domElement, AttrAlias);
|
||||
|
||||
QVector<VPointF> points;
|
||||
|
||||
|
@ -2861,6 +2862,7 @@ void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomEle
|
|||
initData.path->SetColor(color);
|
||||
initData.path->SetPenStyle(penStyle);
|
||||
initData.path->SetApproximationScale(approximationScale);
|
||||
initData.path->SetAliasSuffix(alias);
|
||||
|
||||
VToolCubicBezierPath::Create(initData);
|
||||
}
|
||||
|
|
|
@ -80,6 +80,8 @@ DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, quint32 too
|
|||
connect(ui->comboBoxPoint, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogCubicBezierPath::currentPointChanged);
|
||||
|
||||
connect(ui->lineEditAlias, &QLineEdit::textEdited, this, &DialogCubicBezierPath::ValidateAlias);
|
||||
|
||||
vis = new VisToolCubicBezierPath(data);
|
||||
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
|
@ -112,6 +114,9 @@ void DialogCubicBezierPath::SetPath(const VCubicBezierPath &value)
|
|||
ui->lineEditSplPathName->setText(qApp->TrVars()->VarToUser(path.name()));
|
||||
ui->doubleSpinBoxApproximationScale->setValue(path.GetApproximationScale());
|
||||
|
||||
ui->lineEditAlias->setText(path.GetAliasSuffix());
|
||||
ValidateAlias();
|
||||
|
||||
ChangeCurrentData(ui->comboBoxPenStyle, path.GetPenStyle());
|
||||
ChangeCurrentData(ui->comboBoxColor, path.GetColor());
|
||||
|
||||
|
@ -200,6 +205,7 @@ void DialogCubicBezierPath::SaveData()
|
|||
path.SetPenStyle(GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineLine));
|
||||
path.SetColor(GetComboBoxCurrentData(ui->comboBoxColor, ColorBlack));
|
||||
path.SetApproximationScale(ui->doubleSpinBoxApproximationScale->value());
|
||||
path.SetAliasSuffix(ui->lineEditAlias->text());
|
||||
|
||||
auto visPath = qobject_cast<VisToolCubicBezierPath *>(vis);
|
||||
SCASSERT(visPath != nullptr)
|
||||
|
@ -245,6 +251,25 @@ void DialogCubicBezierPath::currentPointChanged(int index)
|
|||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCubicBezierPath::ValidateAlias()
|
||||
{
|
||||
VCubicBezierPath tempPath = path;
|
||||
tempPath.SetAliasSuffix(ui->lineEditAlias->text());
|
||||
if (not ui->lineEditAlias->text().isEmpty() && not data->IsUnique(tempPath.GetAlias()))
|
||||
{
|
||||
flagAlias = false;
|
||||
ChangeColor(ui->labelAlias, errorColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
flagAlias = true;
|
||||
ChangeColor(ui->labelAlias, OkColor(this));
|
||||
}
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogCubicBezierPath::NewItem(const VPointF &point)
|
||||
{
|
||||
|
|
|
@ -69,6 +69,7 @@ protected:
|
|||
private slots:
|
||||
void PointChanged(int row);
|
||||
void currentPointChanged(int index);
|
||||
void ValidateAlias();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogCubicBezierPath)
|
||||
|
@ -80,6 +81,7 @@ private:
|
|||
qint32 newDuplicate;
|
||||
|
||||
bool flagError;
|
||||
bool flagAlias{true};
|
||||
|
||||
void NewItem(const VPointF &point);
|
||||
void DataPoint(const VPointF &p);
|
||||
|
@ -93,7 +95,7 @@ private:
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool DialogCubicBezierPath::IsValid() const
|
||||
{
|
||||
return flagError;
|
||||
return flagError && flagAlias;
|
||||
}
|
||||
|
||||
#endif // DIALOGCUBICBEZIERPATH_H
|
||||
|
|
|
@ -138,6 +138,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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user