diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 50e3ae8b3..bace202ea 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -907,7 +907,20 @@ QVector VLayoutPiece::Map(const QVector &points) const //--------------------------------------------------------------------------------------------------------------------- QPainterPath VLayoutPiece::ContourPath() const { - QPainterPath path = MainPath(); + QPainterPath path; + + // contour + QVector 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 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 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; } diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index 1f2cf66b7..ba6c20389 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -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; diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index dc422e2ff..768dac577 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -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() { diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index 70e007ed7..995c9d78a 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -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);