Save VPiecePath name.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-28 10:42:37 +02:00
parent 109e23e40d
commit ecdb53b7d0
5 changed files with 26 additions and 3 deletions

View File

@ -3050,6 +3050,7 @@ void VPattern::ParsePathElement(VMainGraphicsScene *scene, QDomElement &domEleme
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const QString name = GetParametrString(domElement, AttrName, tr("Unnamed path"));
const QString defType = QString().setNum(static_cast<int>(PiecePathType::CustomSeamAllowance));
const PiecePathType type = static_cast<PiecePathType>(GetParametrUInt(domElement, AttrType, defType));
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
@ -3062,6 +3063,7 @@ void VPattern::ParsePathElement(VMainGraphicsScene *scene, QDomElement &domEleme
}
path.SetType(type);
path.SetName(name);
VToolPiecePath::Create(id, path, 0, scene, this, data, parse, Source::FromFile, "", idTool);
}

View File

@ -118,6 +118,18 @@ void VPiecePath::SetType(PiecePathType type)
d->m_type = type;
}
//---------------------------------------------------------------------------------------------------------------------
QString VPiecePath::GetName() const
{
return d->m_name;
}
//---------------------------------------------------------------------------------------------------------------------
void VPiecePath::SetName(const QString &name)
{
d->m_name = name;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VPiecePath::PathPoints(const VContainer *data) const
{

View File

@ -63,6 +63,9 @@ public:
PiecePathType GetType() const;
void SetType(PiecePathType type);
QString GetName() const;
void SetName(const QString &name);
QVector<QPointF> PathPoints(const VContainer *data) const;
QVector<QPointF> PathNodePoints(const VContainer *data) const;

View File

@ -43,24 +43,28 @@ class VPiecePathData : public QSharedData
public:
VPiecePathData()
: m_nodes(),
m_type(PiecePathType::Unknown)
m_type(PiecePathType::Unknown),
m_name()
{}
VPiecePathData(PiecePathType type)
: m_nodes(),
m_type(type)
m_type(type),
m_name()
{}
VPiecePathData(const VPiecePathData &path)
: QSharedData(path),
m_nodes(path.m_nodes),
m_type(path.m_type)
m_type(path.m_type),
m_name(path.m_name)
{}
~VPiecePathData();
QVector<VPieceNode> m_nodes;
PiecePathType m_type;
QString m_name;
private:
VPiecePathData &operator=(const VPiecePathData &) Q_DECL_EQ_DELETE;

View File

@ -262,6 +262,7 @@ void DialogPiecePath::SetPiecePath(const VPiecePath &path)
}
SetType(path.GetType());
ui->lineEditName->setText(path.GetName());
ValidObjects(PathIsValid());
@ -348,6 +349,7 @@ VPiecePath DialogPiecePath::CreatePath() const
}
path.SetType(GetType());
path.SetName(ui->lineEditName->text());
return path;
}