From 0ea76c5914f698a71d680f3e0b28b278bd289c1f Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Mon, 18 Jul 2016 20:38:27 +0200 Subject: [PATCH] Few changes at vlayoutdetail class --HG-- branch : feature --- src/libs/vlayout/vlayoutdetail.cpp | 10 +++++++--- src/libs/vlayout/vlayoutdetail.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libs/vlayout/vlayoutdetail.cpp b/src/libs/vlayout/vlayoutdetail.cpp index a5fc4971b..69eee267b 100644 --- a/src/libs/vlayout/vlayoutdetail.cpp +++ b/src/libs/vlayout/vlayoutdetail.cpp @@ -31,6 +31,7 @@ #include #include +#include #if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) # include "../vmisc/vmath.h" @@ -125,7 +126,7 @@ void VLayoutDetail::SetDetailLabelPoints(const QPointF& ptPos, qreal dWidth, qre QPointF ptCenter(ptPos.x() + dWidth/2, ptPos.y() + dHeight/2); QVector v; v << ptPos << QPointF(ptPos.x() + dWidth, ptPos.y()) << QPointF(ptPos.x() + dWidth, ptPos.y() + dHeight) - << QPointF(ptPos.x(), ptPos.y() + dHeight) << ptPos; + << QPointF(ptPos.x(), ptPos.y() + dHeight); for (int i = 0; i < v.count(); ++i) v[i] = RotatePoint(ptCenter, v[i], dAng); d->detailLabel = RoundPoints(v); @@ -144,7 +145,7 @@ void VLayoutDetail::SetPatternInfoPoints(const QPointF& ptPos, qreal dWidth, qre QPointF ptCenter(ptPos.x() + dWidth/2, ptPos.y() + dHeight/2); QVector v; v << ptPos << QPointF(ptPos.x() + dWidth, ptPos.y()) << QPointF(ptPos.x() + dWidth, ptPos.y() + dHeight) - << QPointF(ptPos.x(), ptPos.y() + dHeight) << ptPos; + << QPointF(ptPos.x(), ptPos.y() + dHeight); for (int i = 0; i < v.count(); ++i) v[i] = RotatePoint(ptCenter, v[i], dAng); d->patternInfo = RoundPoints(v); @@ -461,6 +462,7 @@ QPainterPath VLayoutDetail::ContourPath() const if (d->detailLabel.count() > 0) { points = Map(d->detailLabel); + points.push_back(points.at(0)); QPainterPath pathDet; pathDet.moveTo(points.at(0)); @@ -475,6 +477,7 @@ QPainterPath VLayoutDetail::ContourPath() const if (d->patternInfo.count() > 0) { points = Map(d->patternInfo); + points.push_back(points.at(0)); QPainterPath pathDet; pathDet.moveTo(points.at(0)); @@ -527,7 +530,7 @@ void VLayoutDetail::SetMirror(bool value) } //--------------------------------------------------------------------------------------------------------------------- -QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) +QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) const { QPointF ptDest; QPointF ptRel = pt - ptCenter; @@ -536,3 +539,4 @@ QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, q return ptDest + ptCenter; } + diff --git a/src/libs/vlayout/vlayoutdetail.h b/src/libs/vlayout/vlayoutdetail.h index 8358dbbf4..59b7fd53a 100644 --- a/src/libs/vlayout/vlayoutdetail.h +++ b/src/libs/vlayout/vlayoutdetail.h @@ -93,7 +93,7 @@ private: QVector Map(const QVector &points) const; static QVector RoundPoints(const QVector &points); - QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng); + QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng) const; }; Q_DECLARE_TYPEINFO(VLayoutDetail, Q_MOVABLE_TYPE);