Alias field for tool Arc.

This commit is contained in:
Roman Telezhynskyi 2020-11-04 11:01:20 +02:00
parent 8b49ea68c8
commit 1246aba24d
23 changed files with 311 additions and 78 deletions

View File

@ -516,12 +516,32 @@ void VToolOptionsPropertyBrowser::AddPropertyFormula(const QString &propertyName
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyObjectName(Tool *i, const QString &propertyName, bool readOnly)
{
if (readOnly)
{
auto *itemName = new VPE::VLabelProperty(propertyName);
itemName->setValue(qApp->TrVars()->VarToUser(i->name()));
AddProperty(itemName, AttrName);
}
else
{
auto *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true);
itemName->setValue(qApp->TrVars()->VarToUser(i->name()));
itemName->setReadOnly(readOnly);
AddProperty(itemName, AttrName);
}
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyAlias(Tool *i, const QString &propertyName)
{
auto *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true);
itemName->setValue(qApp->TrVars()->VarToUser(i->name()));
itemName->setReadOnly(readOnly);
AddProperty(itemName, AttrName);
itemName->setValue(qApp->TrVars()->VarToUser(i->GetAliasSuffix()));
AddProperty(itemName, AttrAlias);
}
//---------------------------------------------------------------------------------------------------------------------
@ -927,6 +947,26 @@ void VToolOptionsPropertyBrowser::SetNotes(VPE::VProperty *property)
}
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::SetAlias(VPE::VProperty *property)
{
if (auto *i = qgraphicsitem_cast<Tool *>(currentItem))
{
QString notes = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toString();
if (notes == i->GetAliasSuffix())
{
return;
}
i->SetAliasSuffix(notes);
}
else
{
qWarning()<<"Can't cast item";
}
}
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::SetLineType(VPE::VProperty *property)
@ -1275,6 +1315,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArc(VPE::VProperty *property)
case 61: // AttrNotes
SetNotes<VToolArc>(property);
break;
case 62: // AttrAlias
SetAlias<VToolArc>(property);
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
@ -2429,6 +2472,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
AddPropertyFormula(tr("Radius:"), i->GetFormulaRadius(), AttrRadius);
AddPropertyFormula(tr("First angle:"), i->GetFormulaF1(), AttrAngle1);
AddPropertyFormula(tr("Second angle:"), i->GetFormulaF2(), AttrAngle2);
AddPropertyAlias(i, tr("Alias:"));
AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics());
AddPropertyLineColor(i, tr("Color:"), VAbstractTool::ColorsList(), AttrColor);
AddPropertyApproximationScale(tr("Approximation scale:"), i->GetApproximationScale());
@ -3002,6 +3046,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
{
auto *i = qgraphicsitem_cast<VToolArc *>(currentItem);
idToProperty[AttrName]->setValue(i->name());
QVariant valueRadius;
valueRadius.setValue(i->GetFormulaRadius());
idToProperty[AttrRadius]->setValue(valueRadius);
@ -3033,6 +3079,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
idToProperty[AttrAScale]->setValue(valueApproximationScale);
idToProperty[AttrNotes]->setValue(i->GetNotes());
idToProperty[AttrAlias]->setValue(i->GetAliasSuffix());
}
//---------------------------------------------------------------------------------------------------------------------
@ -3844,67 +3892,70 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
//---------------------------------------------------------------------------------------------------------------------
QStringList VToolOptionsPropertyBrowser::PropertiesList() const
{
static QStringList attr = QStringList() << AttrName /* 0 */
<< QLatin1String("position") /* 1 */
<< AttrBasePoint /* 2 */
<< AttrTypeLine /* 3 */
<< AttrLength /* 4 */
<< AttrAngle /* 5 */
<< AttrFirstPoint /* 6 */
<< AttrSecondPoint /* 7 */
<< AttrRadius /* 8 */
<< AttrAngle1 /* 9 */
<< AttrAngle2 /* 10 */
<< AttrCenter /* 11 */
<< AttrThirdPoint /* 12 */
<< AttrArc /* 13 */
<< VToolCutSpline::AttrSpline /* 14 */
<< VToolCutSplinePath::AttrSplinePath /* 15 */
<< AttrP1Line /* 16 */
<< AttrP2Line /* 17 */
<< AttrP1Line1 /* 18 */
<< AttrP2Line1 /* 19 */
<< AttrP1Line2 /* 20 */
<< AttrP2Line2 /* 21 */
<< AttrPShoulder /* 22 */
<< AttrAxisP1 /* 23 */
<< AttrAxisP2 /* 24 */
<< AttrKCurve /*Not used*/ /* 25 */
<< AttrLineColor /* 26 */
<< AttrColor /* 27 */
<< AttrCrossPoint /* 28 */
<< AttrC1Radius /* 29 */
<< AttrC2Radius /* 30 */
<< AttrCRadius /* 31 */
<< AttrName1 /* 32 */
<< AttrName2 /* 33 */
<< AttrVCrossPoint /* 34 */
<< AttrHCrossPoint /* 35 */
<< AttrLength1 /* 36 */
<< AttrLength2 /* 37 */
<< AttrSuffix /* 38 */
<< AttrAxisType /* 39 */
<< AttrRadius1 /* 40 */
<< AttrRadius2 /* 41 */
<< AttrRotationAngle /* 42 */
<< AttrDartP1 /* 43 */
<< AttrDartP2 /* 44 */
<< AttrDartP3 /* 45 */
<< AttrCurve /* 46 */
<< AttrFirstArc /* 47 */
<< AttrSecondArc /* 48 */
<< AttrC1Center /* 49 */
<< AttrC2Center /* 50 */
<< AttrCurve1 /* 51 */
<< AttrCurve2 /* 52 */
<< AttrCCenter /* 53 */
<< AttrTangent /* 54 */
<< AttrPoint1 /* 55 */
<< AttrPoint2 /* 56 */
<< AttrPoint3 /* 57 */
<< AttrPoint4 /* 58 */
<< AttrPenStyle /* 59 */
<< AttrAScale /* 60 */
<< AttrNotes; /* 61 */
static QStringList attr{
AttrName, /* 0 */
QLatin1String("position"), /* 1 */
AttrBasePoint, /* 2 */
AttrTypeLine, /* 3 */
AttrLength, /* 4 */
AttrAngle, /* 5 */
AttrFirstPoint, /* 6 */
AttrSecondPoint, /* 7 */
AttrRadius, /* 8 */
AttrAngle1, /* 9 */
AttrAngle2, /* 10 */
AttrCenter, /* 11 */
AttrThirdPoint, /* 12 */
AttrArc, /* 13 */
VToolCutSpline::AttrSpline, /* 14 */
VToolCutSplinePath::AttrSplinePath, /* 15 */
AttrP1Line, /* 16 */
AttrP2Line, /* 17 */
AttrP1Line1, /* 18 */
AttrP2Line1, /* 19 */
AttrP1Line2, /* 20 */
AttrP2Line2, /* 21 */
AttrPShoulder, /* 22 */
AttrAxisP1, /* 23 */
AttrAxisP2, /* 24 */
AttrKCurve, /*Not used*/ /* 25 */
AttrLineColor, /* 26 */
AttrColor, /* 27 */
AttrCrossPoint, /* 28 */
AttrC1Radius, /* 29 */
AttrC2Radius, /* 30 */
AttrCRadius, /* 31 */
AttrName1, /* 32 */
AttrName2, /* 33 */
AttrVCrossPoint, /* 34 */
AttrHCrossPoint, /* 35 */
AttrLength1, /* 36 */
AttrLength2, /* 37 */
AttrSuffix, /* 38 */
AttrAxisType, /* 39 */
AttrRadius1, /* 40 */
AttrRadius2, /* 41 */
AttrRotationAngle, /* 42 */
AttrDartP1, /* 43 */
AttrDartP2, /* 44 */
AttrDartP3, /* 45 */
AttrCurve, /* 46 */
AttrFirstArc, /* 47 */
AttrSecondArc, /* 48 */
AttrC1Center, /* 49 */
AttrC2Center, /* 50 */
AttrCurve1, /* 51 */
AttrCurve2, /* 52 */
AttrCCenter, /* 53 */
AttrTangent, /* 54 */
AttrPoint1, /* 55 */
AttrPoint2, /* 56 */
AttrPoint3, /* 57 */
AttrPoint4, /* 58 */
AttrPenStyle, /* 59 */
AttrAScale, /* 60 */
AttrNotes, /* 61 */
AttrAlias /* 62 */
};
return attr;
}

View File

@ -96,6 +96,9 @@ private:
template<class Tool>
void SetNotes(VPE::VProperty *property);
template<class Tool>
void SetAlias(VPE::VProperty *property);
template<class Tool>
void SetLineType(VPE::VProperty *property);
@ -129,6 +132,9 @@ private:
template<class Tool>
void AddPropertyObjectName(Tool *i, const QString &propertyName, bool readOnly = false);
template<class Tool>
void AddPropertyAlias(Tool *i, const QString &propertyName);
template<class Tool>
void AddPropertyPointName1(Tool *i, const QString &propertyName);

View File

@ -2992,6 +2992,7 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
initData.color = GetParametrString(domElement, AttrColor, ColorBlack);
initData.penStyle = GetParametrString(domElement, AttrPenStyle, TypeLineLine);
initData.approximationScale = GetParametrDouble(domElement, AttrAScale, QChar('0'));
initData.aliasSuffix = GetParametrEmptyString(domElement, AttrAlias);
VToolArc::Create(initData);
//Rewrite attribute formula. Need for situation when we have wrong formula.

View File

@ -134,6 +134,7 @@ const QString AttrVersion = QStringLiteral("version");
const QString AttrFirstToCountour = QStringLiteral("firstToCountour");
const QString AttrLastToCountour = QStringLiteral("lastToCountour");
const QString AttrNotes = QStringLiteral("notes");
const QString AttrAlias = QStringLiteral("alias");
const QString TypeLineNone = QStringLiteral("none");
const QString TypeLineLine = QStringLiteral("hair");

View File

@ -152,6 +152,7 @@ extern const QString AttrVersion;
extern const QString AttrFirstToCountour;
extern const QString AttrLastToCountour;
extern const QString AttrNotes;
extern const QString AttrAlias;
extern const QString TypeLineNone;
extern const QString TypeLineLine;

View File

@ -181,7 +181,8 @@ QString VAbstractArc::NameForHistory(const QString &toolName) const
{
name += QString("_%1").arg(GetDuplicate());
}
return name;
return not GetAlias().isEmpty() ? QString("%1 (%2)").arg(GetAlias(), name) : name;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -516,6 +516,19 @@ void VAbstractCubicBezier::CreateName()
setName(name);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCubicBezier::CreateAlias()
{
const QString aliasSuffix = GetAliasSuffix();
if (aliasSuffix.isEmpty())
{
SetAlias(QString());
return;
}
SetAlias(SPL_ + aliasSuffix);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief GetCubicBezierPoints return list with cubic bezier curve points.

View File

@ -63,6 +63,7 @@ public:
protected:
virtual void CreateName() override;
virtual void CreateAlias() override;
static QVector<QPointF> GetCubicBezierPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3,
const QPointF &p4, qreal approximationScale);

View File

@ -288,3 +288,16 @@ void VAbstractCubicBezierPath::CreateName()
}
setName(name);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCubicBezierPath::CreateAlias()
{
const QString aliasSuffix = GetAliasSuffix();
if (aliasSuffix.isEmpty())
{
SetAlias(QString());
return;
}
SetAlias(splPath + '_' + aliasSuffix);
}

View File

@ -74,6 +74,7 @@ public:
protected:
virtual void CreateName() override;
virtual void CreateAlias() override;
virtual VPointF FirstPoint() const =0;
virtual VPointF LastPoint() const =0;

View File

@ -603,6 +603,13 @@ qreal VAbstractCurve::LengthCurveDirectionArrow()
return qApp->Settings()->GetLineWidth() * 8.0;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractCurve::SetAliasSuffix(const QString &aliasSuffix)
{
VGObject::SetAliasSuffix(aliasSuffix);
CreateAlias();
}
//---------------------------------------------------------------------------------------------------------------------
qreal VAbstractCurve::PathLength(const QVector<QPointF> &path)
{

View File

@ -105,8 +105,11 @@ public:
static QPainterPath ShowDirection(const QVector<DirectionArrow> &arrows, qreal width);
static qreal LengthCurveDirectionArrow();
virtual void SetAliasSuffix(const QString &aliasSuffix) override;
protected:
virtual void CreateName() =0;
virtual void CreateName() =0;
virtual void CreateAlias() =0;
private:
QSharedDataPointer<VAbstractCurveData> d;

View File

@ -378,7 +378,7 @@ QPointF VArc::CutArc(qreal length) const
//---------------------------------------------------------------------------------------------------------------------
void VArc::CreateName()
{
QString name = ARC_ + QString("%1").arg(this->GetCenter().name());
QString name = ARC_ + this->GetCenter().name();
if (getMode() == Draw::Modeling && getIdObject() != NULL_ID)
{
@ -397,6 +397,19 @@ void VArc::CreateName()
setName(name);
}
//---------------------------------------------------------------------------------------------------------------------
void VArc::CreateAlias()
{
const QString aliasSuffix = GetAliasSuffix();
if (aliasSuffix.isEmpty())
{
SetAlias(QString());
return;
}
SetAlias(ARC_ + aliasSuffix);
}
//---------------------------------------------------------------------------------------------------------------------
void VArc::FindF2(qreal length)
{

View File

@ -85,6 +85,7 @@ public:
QPointF CutArc (qreal length) const;
protected:
virtual void CreateName() override;
virtual void CreateAlias() override;
virtual void FindF2(qreal length) override;
private:
QSharedDataPointer<VArcData> d;

View File

@ -399,6 +399,19 @@ void VEllipticalArc::CreateName()
setName(name);
}
//---------------------------------------------------------------------------------------------------------------------
void VEllipticalArc::CreateAlias()
{
const QString aliasSuffix = GetAliasSuffix();
if (aliasSuffix.isEmpty())
{
SetAlias(QString());
return;
}
SetAlias(ELARC_ + aliasSuffix);
}
//---------------------------------------------------------------------------------------------------------------------
void VEllipticalArc::FindF2(qreal length)
{

View File

@ -104,6 +104,7 @@ public:
static qreal OptimizeAngle(qreal angle);
protected:
virtual void CreateName() override;
virtual void CreateAlias() override;
virtual void FindF2(qreal length) override;
private:
QSharedDataPointer<VEllipticalArcData> d;

View File

@ -47,6 +47,7 @@
#include "../vmisc/vabstractapplication.h"
#include "../vmisc/vcommonsettings.h"
#include "ui_dialogarc.h"
#include "../vgeometry/varc.h"
//---------------------------------------------------------------------------------------------------------------------
/**
@ -122,6 +123,8 @@ DialogArc::DialogArc(const VContainer *data, quint32 toolId, QWidget *parent)
connect(ui->pushButtonGrowLengthF1, &QPushButton::clicked, this, &DialogArc::DeployF1TextEdit);
connect(ui->pushButtonGrowLengthF2, &QPushButton::clicked, this, &DialogArc::DeployF2TextEdit);
connect(ui->lineEditAlias, &QLineEdit::textEdited, this, &DialogArc::GetAliasSuffix);
vis = new VisToolArc(data);
ui->tabWidget->setCurrentIndex(0);
@ -237,6 +240,19 @@ QString DialogArc::GetNotes() const
return ui->plainTextEditToolNotes->toPlainText();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::SetAliasSuffix(const QString &alias)
{
ui->lineEditAlias->setText(alias);
ValidateAlias();
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogArc::GetAliasSuffix() const
{
return ui->lineEditAlias->text();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetF1 set formula first angle of arc
@ -337,6 +353,25 @@ void DialogArc::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::ValidateAlias()
{
VArc 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 DialogArc::FXRadius()
{

View File

@ -76,6 +76,9 @@ public:
void SetNotes(const QString &notes);
QString GetNotes() const;
void SetAliasSuffix(const QString &alias);
QString GetAliasSuffix() const;
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
/**
@ -97,6 +100,9 @@ protected:
virtual void SaveData() override;
virtual void closeEvent(QCloseEvent *event) override;
virtual bool IsValid() const final;
private slots:
void ValidateAlias();
private:
Q_DISABLE_COPY(DialogArc)
@ -112,6 +118,8 @@ private:
/** @brief flagF2 true if value of second angle is correct */
bool flagF2;
bool flagAlias{true};
/** @brief timerRadius timer of check formula of radius */
QTimer *timerRadius;
@ -145,7 +153,7 @@ private:
//---------------------------------------------------------------------------------------------------------------------
inline bool DialogArc::IsValid() const
{
return flagRadius && flagF1 && flagF2;
return flagRadius && flagF1 && flagF2 && flagAlias;
}
#endif // DIALOGARC_H

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>407</width>
<height>456</height>
<height>476</height>
</rect>
</property>
<property name="windowTitle">
@ -662,6 +662,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>

View File

@ -332,6 +332,7 @@ void VAbstractSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &ob
doc->SetAttribute(tag, AttrColor, curve->GetColor());
doc->SetAttribute(tag, AttrPenStyle, curve->GetPenStyle());
doc->SetAttribute(tag, AttrAScale, curve->GetApproximationScale());
doc->SetAttributeOrRemoveIf(tag, AttrAlias, curve->GetAliasSuffix(), curve->GetAliasSuffix().isEmpty());
}
//---------------------------------------------------------------------------------------------------------------------
@ -494,6 +495,21 @@ quint32 VAbstractSpline::GetDuplicate() const
return VAbstractTool::data.GeometricObject<VAbstractCurve>(m_id)->GetDuplicate();
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractSpline::GetAliasSuffix() const
{
return ObjectAliasSuffix<VAbstractCurve>(m_id);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::SetAliasSuffix(const QString &alias)
{
QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(m_id);
curve->SetAliasSuffix(alias);
QSharedPointer<VGObject> obj = qSharedPointerCast<VGObject>(curve);
SaveOption(obj);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractSpline::GroupVisibility(quint32 object, bool visible)
{

View File

@ -66,6 +66,7 @@ struct VAbstractSplineInitData : VDrawToolInitData
QString color;
QString penStyle;
qreal approximationScale;
QString aliasSuffix{};
};
class VAbstractSpline:public VDrawTool, public QGraphicsPathItem
@ -95,13 +96,16 @@ public:
quint32 GetDuplicate() const;
QString GetAliasSuffix() const;
void SetAliasSuffix(const QString &alias);
virtual void GroupVisibility(quint32 object, bool visible) override;
public slots:
virtual void FullUpdateFromFile () override;
virtual void Disable(bool disable, const QString &namePP) override;
virtual void DetailsMode(bool mode) override;
virtual void AllowHover(bool enabled) override;
virtual void AllowSelecting(bool enabled) override;
virtual void FullUpdateFromFile () override;
virtual void Disable(bool disable, const QString &namePP) override;
virtual void DetailsMode(bool mode) override;
virtual void AllowHover(bool enabled) override;
virtual void AllowSelecting(bool enabled) override;
signals:
/**
* @brief setEnabledPoint disable control points.

View File

@ -91,6 +91,7 @@ void VToolArc::setDialog()
dialogTool->SetPenStyle(arc->GetPenStyle());
dialogTool->SetApproximationScale(arc->GetApproximationScale());
dialogTool->SetNotes(m_notes);
dialogTool->SetAliasSuffix(arc->GetAliasSuffix());
}
//---------------------------------------------------------------------------------------------------------------------
@ -122,6 +123,7 @@ VToolArc* VToolArc::Create(const QPointer<DialogTool> &dialog, VMainGraphicsScen
initData.typeCreation = Source::FromGui;
initData.approximationScale = dialogTool->GetApproximationScale();
initData.notes = dialogTool->GetNotes();
initData.aliasSuffix = dialogTool->GetAliasSuffix();
VToolArc* point = Create(initData);
if (point != nullptr)
@ -150,6 +152,7 @@ VToolArc* VToolArc::Create(VToolArcInitData &initData)
arc->SetColor(initData.color);
arc->SetPenStyle(initData.penStyle);
arc->SetApproximationScale(initData.approximationScale);
arc->SetAliasSuffix(initData.aliasSuffix);
if (initData.typeCreation == Source::FromGui)
{
@ -338,6 +341,8 @@ void VToolArc::SaveDialog(QDomElement &domElement, QList<quint32> &oldDependenci
doc->SetAttribute(domElement, AttrColor, dialogTool->GetColor());
doc->SetAttribute(domElement, AttrPenStyle, dialogTool->GetPenStyle());
doc->SetAttribute(domElement, AttrAScale, dialogTool->GetApproximationScale());
doc->SetAttributeOrRemoveIf(domElement, AttrAlias, dialogTool->GetAliasSuffix(),
dialogTool->GetAliasSuffix().isEmpty());
const QString notes = dialogTool->GetNotes();
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
@ -398,6 +403,6 @@ QString VToolArc::MakeToolTip() const
.arg(arc->GetStartAngle())
.arg(tr("End angle"))
.arg(arc->GetEndAngle())
.arg(tr("Label"), arc->name());
.arg(tr("Label"), arc->ObjectName());
return toolTip;
}

View File

@ -138,6 +138,9 @@ protected:
template <class T>
QString ObjectName(quint32 id) const;
template <class T>
QString ObjectAliasSuffix(quint32 id) const;
template <class T>
static void InitDrawToolConnections(VMainGraphicsScene *scene, T *tool);
private:
@ -357,14 +360,35 @@ QString VDrawTool::ObjectName(quint32 id) const
{
try
{
return data.GeometricObject<T>(id)->name();
return data.GeometricObject<T>(id)->ObjectName();
}
catch (const VExceptionBadId &e)
{
qCDebug(vTool, "Error! Couldn't get object name by id = %s. %s %s", qUtf8Printable(QString().setNum(id)),
qUtf8Printable(e.ErrorMessage()),
qUtf8Printable(e.DetailedInformation()));
return QString(QString());// Return empty string for property browser
return QString();// Return empty string for property browser
}
}
//---------------------------------------------------------------------------------------------------------------------
template <class T>
/**
* @brief ObjectAlias get object (point, curve, arc) alias.
* @param id object id in container.
*/
QString VDrawTool::ObjectAliasSuffix(quint32 id) const
{
try
{
return data.GeometricObject<T>(id)->GetAliasSuffix();
}
catch (const VExceptionBadId &e)
{
qCDebug(vTool, "Error! Couldn't get object alias suffix by id = %s. %s %s", qUtf8Printable(QString().setNum(id)),
qUtf8Printable(e.ErrorMessage()),
qUtf8Printable(e.DetailedInformation()));
return QString();// Return empty string for property browser
}
}