Refactor class VLayoutPiecePath.
Optimizing code style. --HG-- branch : develop
This commit is contained in:
parent
f7868c03c1
commit
7dc420ad47
|
@ -72,7 +72,10 @@ QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VConta
|
||||||
const VPiecePath path = pattern->GetPiecePath(id);
|
const VPiecePath path = pattern->GetPiecePath(id);
|
||||||
if (path.GetType() == PiecePathType::InternalPath && path.IsVisible(pattern->DataVariables()))
|
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;
|
return paths;
|
||||||
|
|
|
@ -39,8 +39,8 @@ VLayoutPiecePath::VLayoutPiecePath()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPiecePath::VLayoutPiecePath(const QVector<QPointF> &points, bool cut, Qt::PenStyle penStyle)
|
VLayoutPiecePath::VLayoutPiecePath(const QVector<QPointF> &points)
|
||||||
: d(new VLayoutPiecePathData(points, cut, penStyle))
|
: d(new VLayoutPiecePathData(points))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QSharedDataPointer>
|
#include <QSharedDataPointer>
|
||||||
|
#include <QMetaType>
|
||||||
|
|
||||||
class VLayoutPiecePathData;
|
class VLayoutPiecePathData;
|
||||||
class QPainterPath;
|
class QPainterPath;
|
||||||
|
@ -39,7 +40,7 @@ class VLayoutPiecePath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VLayoutPiecePath();
|
VLayoutPiecePath();
|
||||||
VLayoutPiecePath(const QVector<QPointF> &points, bool cut, Qt::PenStyle penStyle = Qt::SolidLine);
|
explicit VLayoutPiecePath(const QVector<QPointF> &points);
|
||||||
VLayoutPiecePath(const VLayoutPiecePath &path);
|
VLayoutPiecePath(const VLayoutPiecePath &path);
|
||||||
|
|
||||||
virtual ~VLayoutPiecePath();
|
virtual ~VLayoutPiecePath();
|
||||||
|
@ -67,6 +68,7 @@ private:
|
||||||
QSharedDataPointer<VLayoutPiecePathData> d;
|
QSharedDataPointer<VLayoutPiecePathData> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(VLayoutPiecePath)
|
||||||
Q_DECLARE_TYPEINFO(VLayoutPiecePath, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(VLayoutPiecePath, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
#endif // VLAYOUTPIECEPATH_H
|
#endif // VLAYOUTPIECEPATH_H
|
||||||
|
|
|
@ -43,15 +43,10 @@ class VLayoutPiecePathData : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VLayoutPiecePathData()
|
VLayoutPiecePathData()
|
||||||
: m_points(),
|
|
||||||
m_penStyle(Qt::SolidLine),
|
|
||||||
m_cut(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VLayoutPiecePathData(const QVector<QPointF> points, bool cut, Qt::PenStyle penStyle)
|
VLayoutPiecePathData(const QVector<QPointF> &points)
|
||||||
: m_points(points),
|
: m_points(points)
|
||||||
m_penStyle(penStyle),
|
|
||||||
m_cut(cut)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VLayoutPiecePathData(const VLayoutPiecePathData &path)
|
VLayoutPiecePathData(const VLayoutPiecePathData &path)
|
||||||
|
@ -64,12 +59,12 @@ public:
|
||||||
~VLayoutPiecePathData() Q_DECL_EQ_DEFAULT;
|
~VLayoutPiecePathData() Q_DECL_EQ_DEFAULT;
|
||||||
|
|
||||||
/** @brief m_points list of path points. */
|
/** @brief m_points list of path points. */
|
||||||
QVector<QPointF> m_points;
|
QVector<QPointF> m_points{};
|
||||||
|
|
||||||
/** @brief m_penStyle path pen style. */
|
/** @brief m_penStyle path pen style. */
|
||||||
Qt::PenStyle m_penStyle;
|
Qt::PenStyle m_penStyle{Qt::SolidLine};
|
||||||
|
|
||||||
bool m_cut;
|
bool m_cut{false};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VLayoutPiecePathData &operator=(const VLayoutPiecePathData &) Q_DECL_EQ_DELETE;
|
VLayoutPiecePathData &operator=(const VLayoutPiecePathData &) Q_DECL_EQ_DELETE;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user