Fix wrong piece bounding rect if disable a main path.
--HG-- branch : develop
This commit is contained in:
parent
ef6ac0a157
commit
99de6f8e22
|
@ -907,7 +907,20 @@ QVector<T> VLayoutPiece::Map(const QVector<T> &points) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VLayoutPiece::ContourPath() const
|
||||
{
|
||||
QPainterPath path = MainPath();
|
||||
QPainterPath path;
|
||||
|
||||
// contour
|
||||
QVector<QPointF> points = GetContourPoints();
|
||||
|
||||
if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
path.moveTo(points.at(0));
|
||||
for (qint32 i = 1; i < points.count(); ++i)
|
||||
{
|
||||
path.lineTo(points.at(i));
|
||||
}
|
||||
path.lineTo(points.at(0));
|
||||
}
|
||||
|
||||
// seam allowance
|
||||
if (IsSeamAllowance())
|
||||
|
@ -948,27 +961,6 @@ QPainterPath VLayoutPiece::ContourPath() const
|
|||
return path;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VLayoutPiece::MainPath() const
|
||||
{
|
||||
QPainterPath path;
|
||||
|
||||
// contour
|
||||
QVector<QPointF> points = GetContourPoints();
|
||||
|
||||
if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
path.moveTo(points.at(0));
|
||||
for (qint32 i = 1; i < points.count(); ++i)
|
||||
{
|
||||
path.lineTo(points.at(i));
|
||||
}
|
||||
path.lineTo(points.at(0));
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const
|
||||
{
|
||||
|
@ -1157,7 +1149,20 @@ QGraphicsPathItem *VLayoutPiece::GetMainItem() const
|
|||
QGraphicsPathItem *VLayoutPiece::GetMainPathItem() const
|
||||
{
|
||||
QGraphicsPathItem *item = new QGraphicsPathItem();
|
||||
item->setPath(MainPath());
|
||||
|
||||
QPainterPath path;
|
||||
|
||||
// contour
|
||||
QVector<QPointF> points = GetContourPoints();
|
||||
|
||||
path.moveTo(points.at(0));
|
||||
for (qint32 i = 1; i < points.count(); ++i)
|
||||
{
|
||||
path.lineTo(points.at(i));
|
||||
}
|
||||
path.lineTo(points.at(0));
|
||||
|
||||
item->setPath(path);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,6 @@ public:
|
|||
bool isNull() const;
|
||||
qint64 Square() const;
|
||||
QPainterPath ContourPath() const;
|
||||
QPainterPath MainPath() const;
|
||||
|
||||
QPainterPath LayoutAllowancePath() const;
|
||||
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
||||
|
|
|
@ -804,6 +804,13 @@ void VToolSeamAllowance::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
|||
QGraphicsPathItem::paint(painter, option, widget);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QRectF VToolSeamAllowance::boundingRect() const
|
||||
{
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(id);
|
||||
return detail.MainPathPath(this->getData()).boundingRect();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::AddToFile()
|
||||
{
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget) Q_DECL_OVERRIDE;
|
||||
virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
|
||||
void EnableToolMove(bool move);
|
||||
|
|
Loading…
Reference in New Issue
Block a user