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