Refactor class VLayoutPiecePath.

Optimizing code style.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-05-27 14:51:58 +03:00
parent f7868c03c1
commit 7dc420ad47
4 changed files with 14 additions and 14 deletions

View File

@ -72,7 +72,10 @@ QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VConta
const VPiecePath path = pattern->GetPiecePath(id);
if (path.GetType() == PiecePathType::InternalPath && path.IsVisible(pattern->DataVariables()))
{
paths.append(VLayoutPiecePath(path.PathPoints(pattern, cuttingPath), path.IsCutPath(), path.GetPenType()));
VLayoutPiecePath convertedPath = VLayoutPiecePath(path.PathPoints(pattern, cuttingPath));
convertedPath.SetCutPath(path.IsCutPath());
convertedPath.SetPenStyle(path.GetPenType());
paths.append(convertedPath);
}
}
return paths;

View File

@ -39,8 +39,8 @@ VLayoutPiecePath::VLayoutPiecePath()
}
//---------------------------------------------------------------------------------------------------------------------
VLayoutPiecePath::VLayoutPiecePath(const QVector<QPointF> &points, bool cut, Qt::PenStyle penStyle)
: d(new VLayoutPiecePathData(points, cut, penStyle))
VLayoutPiecePath::VLayoutPiecePath(const QVector<QPointF> &points)
: d(new VLayoutPiecePathData(points))
{
}

View File

@ -31,6 +31,7 @@
#include <QPointF>
#include <QSharedDataPointer>
#include <QMetaType>
class VLayoutPiecePathData;
class QPainterPath;
@ -39,7 +40,7 @@ class VLayoutPiecePath
{
public:
VLayoutPiecePath();
VLayoutPiecePath(const QVector<QPointF> &points, bool cut, Qt::PenStyle penStyle = Qt::SolidLine);
explicit VLayoutPiecePath(const QVector<QPointF> &points);
VLayoutPiecePath(const VLayoutPiecePath &path);
virtual ~VLayoutPiecePath();
@ -67,6 +68,7 @@ private:
QSharedDataPointer<VLayoutPiecePathData> d;
};
Q_DECLARE_METATYPE(VLayoutPiecePath)
Q_DECLARE_TYPEINFO(VLayoutPiecePath, Q_MOVABLE_TYPE);
#endif // VLAYOUTPIECEPATH_H

View File

@ -43,15 +43,10 @@ class VLayoutPiecePathData : public QSharedData
{
public:
VLayoutPiecePathData()
: m_points(),
m_penStyle(Qt::SolidLine),
m_cut(false)
{}
VLayoutPiecePathData(const QVector<QPointF> points, bool cut, Qt::PenStyle penStyle)
: m_points(points),
m_penStyle(penStyle),
m_cut(cut)
VLayoutPiecePathData(const QVector<QPointF> &points)
: m_points(points)
{}
VLayoutPiecePathData(const VLayoutPiecePathData &path)
@ -64,12 +59,12 @@ public:
~VLayoutPiecePathData() Q_DECL_EQ_DEFAULT;
/** @brief m_points list of path points. */
QVector<QPointF> m_points;
QVector<QPointF> m_points{};
/** @brief m_penStyle path pen style. */
Qt::PenStyle m_penStyle;
Qt::PenStyle m_penStyle{Qt::SolidLine};
bool m_cut;
bool m_cut{false};
private:
VLayoutPiecePathData &operator=(const VLayoutPiecePathData &) Q_DECL_EQ_DELETE;