Alias field for tool Elliptical arc.
This commit is contained in:
parent
7542fc5dc2
commit
0301c8289f
|
@ -2401,6 +2401,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolEllipticalArc(VPE::VProperty *pr
|
|||
case 27://AttrColor
|
||||
SetLineColor<VToolEllipticalArc>(property);
|
||||
break;
|
||||
case 62: // AttrAlias
|
||||
SetAlias<VToolEllipticalArc>(property);
|
||||
break;
|
||||
case 59: // AttrPenStyle
|
||||
SetPenStyle<VToolEllipticalArc>(property);
|
||||
break;
|
||||
|
@ -2970,6 +2973,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolEllipticalArc(QGraphicsItem *it
|
|||
AddPropertyFormula(tr("First angle:"), i->GetFormulaF1(), AttrAngle1);
|
||||
AddPropertyFormula(tr("Second angle:"), i->GetFormulaF2(), AttrAngle2);
|
||||
AddPropertyFormula(tr("Rotation angle:"), i->GetFormulaRotationAngle(), AttrRotationAngle);
|
||||
AddPropertyAlias(i, tr("Alias:"));
|
||||
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
|
||||
AddPropertyText(tr("Notes:"), i->GetNotes(), AttrNotes);
|
||||
}
|
||||
|
@ -3867,6 +3871,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
|
|||
{
|
||||
auto *i = qgraphicsitem_cast<VToolEllipticalArc *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
|
||||
QVariant valueFormulaRadius1;
|
||||
valueFormulaRadius1.setValue(i->GetFormulaRadius1());
|
||||
idToProperty[AttrRadius1]->setValue(valueFormulaRadius1);
|
||||
|
@ -3895,6 +3901,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
|
|||
idToProperty[AttrCenter]->setValue(valueCenterPoint);
|
||||
|
||||
idToProperty[AttrNotes]->setValue(i->GetNotes());
|
||||
|
||||
idToProperty[AttrAlias]->setValue(i->GetAliasSuffix());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -3049,6 +3049,7 @@ void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &do
|
|||
initData.color = GetParametrString(domElement, AttrColor, ColorBlack);
|
||||
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
|
||||
initData.approximationScale = GetParametrDouble(domElement, AttrAScale, QChar('0'));
|
||||
initData.aliasSuffix = GetParametrEmptyString(domElement, AttrAlias);
|
||||
|
||||
VToolEllipticalArc::Create(initData);
|
||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "ui_dialogellipticalarc.h"
|
||||
#include "../vgeometry/vellipticalarc.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -154,6 +155,8 @@ DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, quint32 toolId,
|
|||
connect(ui->pushButtonGrowLengthRotationAngle, &QPushButton::clicked,
|
||||
this, &DialogEllipticalArc::DeployRotationAngleTextEdit);
|
||||
|
||||
connect(ui->lineEditAlias, &QLineEdit::textEdited, this, &DialogEllipticalArc::ValidateAlias);
|
||||
|
||||
vis = new VisToolEllipticalArc(data);
|
||||
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
|
@ -592,6 +595,25 @@ void DialogEllipticalArc::closeEvent(QCloseEvent *event)
|
|||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEllipticalArc::ValidateAlias()
|
||||
{
|
||||
VEllipticalArc arc;
|
||||
arc.SetAliasSuffix(GetAliasSuffix());
|
||||
if (not GetAliasSuffix().isEmpty() && not data->IsUnique(arc.GetAlias()))
|
||||
{
|
||||
flagAlias = false;
|
||||
ChangeColor(ui->labelAlias, errorColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
flagAlias = true;
|
||||
ChangeColor(ui->labelAlias, OkColor(this));
|
||||
}
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEllipticalArc::SetNotes(const QString ¬es)
|
||||
{
|
||||
|
@ -603,3 +625,16 @@ QString DialogEllipticalArc::GetNotes() const
|
|||
{
|
||||
return ui->plainTextEditToolNotes->toPlainText();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogEllipticalArc::SetAliasSuffix(const QString &alias)
|
||||
{
|
||||
ui->lineEditAlias->setText(alias);
|
||||
ValidateAlias();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogEllipticalArc::GetAliasSuffix() const
|
||||
{
|
||||
return ui->lineEditAlias->text();
|
||||
}
|
||||
|
|
|
@ -77,6 +77,9 @@ public:
|
|||
void SetNotes(const QString ¬es);
|
||||
QString GetNotes() const;
|
||||
|
||||
void SetAliasSuffix(const QString &alias);
|
||||
QString GetAliasSuffix() const;
|
||||
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||
/**
|
||||
|
@ -103,6 +106,9 @@ protected:
|
|||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual bool IsValid() const final;
|
||||
|
||||
private slots:
|
||||
void ValidateAlias();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogEllipticalArc)
|
||||
|
||||
|
@ -124,6 +130,8 @@ private:
|
|||
/** @brief flagRotationAngle true if value of rotation angle is correct */
|
||||
bool flagRotationAngle;
|
||||
|
||||
bool flagAlias{true};
|
||||
|
||||
/** @brief timerRadius1 timer of check formula of radius1 */
|
||||
QTimer *timerRadius1;
|
||||
|
||||
|
@ -172,7 +180,7 @@ private:
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool DialogEllipticalArc::IsValid() const
|
||||
{
|
||||
return flagRadius1 && flagRadius2 && flagF1 && flagF2 && flagRotationAngle;
|
||||
return flagRadius1 && flagRadius2 && flagF1 && flagF2 && flagRotationAngle && flagAlias;
|
||||
}
|
||||
|
||||
#endif // DIALOGELLIPTICALARC_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>575</height>
|
||||
<height>595</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -1026,6 +1026,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelAlias">
|
||||
<property name="text">
|
||||
<string>Alias:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditAlias"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -93,6 +93,7 @@ void VToolEllipticalArc::setDialog()
|
|||
dialogTool->SetColor(elArc->GetColor());
|
||||
dialogTool->SetPenStyle(elArc->GetPenStyle());
|
||||
dialogTool->SetNotes(m_notes);
|
||||
dialogTool->SetAliasSuffix(elArc->GetAliasSuffix());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -125,6 +126,7 @@ VToolEllipticalArc* VToolEllipticalArc::Create(const QPointer<DialogTool> &dialo
|
|||
initData.parse = Document::FullParse;
|
||||
initData.typeCreation = Source::FromGui;
|
||||
initData.notes = dialogTool->GetNotes();
|
||||
initData.aliasSuffix = dialogTool->GetAliasSuffix();
|
||||
//initData.approximationScale = dialogTool->GetApproximationScale(); // For future use
|
||||
|
||||
VToolEllipticalArc* point = Create(initData);
|
||||
|
@ -159,6 +161,7 @@ VToolEllipticalArc* VToolEllipticalArc::Create(VToolEllipticalArcInitData &initD
|
|||
elArc->SetColor(initData.color);
|
||||
elArc->SetPenStyle(initData.penStyle);
|
||||
elArc->SetApproximationScale(initData.approximationScale);
|
||||
elArc->SetAliasSuffix(initData.aliasSuffix);
|
||||
|
||||
if (initData.typeCreation == Source::FromGui)
|
||||
{
|
||||
|
@ -385,6 +388,8 @@ void VToolEllipticalArc::SaveDialog(QDomElement &domElement, QList<quint32> &old
|
|||
doc->SetAttribute(domElement, AttrRotationAngle, dialogTool->GetRotationAngle());
|
||||
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
|
||||
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
|
||||
doc->SetAttributeOrRemoveIf(domElement, AttrAlias, dialogTool->GetAliasSuffix(),
|
||||
dialogTool->GetAliasSuffix().isEmpty());
|
||||
|
||||
const QString notes = dialogTool->GetNotes();
|
||||
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
|
||||
|
@ -455,7 +460,7 @@ QString VToolEllipticalArc::MakeToolTip() const
|
|||
.arg(tr("End angle")) // 10
|
||||
.arg(elArc->GetEndAngle()) // 11
|
||||
.arg(tr("Label"), // 12
|
||||
elArc->name(), // 13
|
||||
elArc->ObjectName(), // 13
|
||||
tr("Rotation")) // 14
|
||||
.arg(elArc->GetRotationAngle()); // 15
|
||||
return toolTip;
|
||||
|
|
Loading…
Reference in New Issue
Block a user