From 054560c7a06f405aab96c337fd3ab0cd4554f610 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 23 Sep 2020 16:54:06 +0300 Subject: [PATCH] Fix label size for case with two pins. (cherry picked from commit 64f70a58cfa9b4481d97bf55ca65693e942f1435) --- ChangeLog.txt | 1 + src/libs/vlayout/vlayoutpiece.cpp | 14 +++----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 45f80584c..6d1476ad2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -92,6 +92,7 @@ - Incorrect conversion to newer curve format. - Elide a variable description in the formula wizard. - Fix removing a pin in the Seam Allowance tool dialog. +- Fix label size for case with two pins. # Version 0.6.1 October 23, 2018 - [#885] Regression. Broken support for multi size measurements. diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index d87e54255..b9fc0c890 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -135,9 +135,11 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat { Calculator cal1; labelWidth = cal1.EvalFormula(pattern->DataVariables(), labelData.GetLabelWidth()); + labelWidth = ToPixel(labelWidth, *pattern->GetPatternUnit()); Calculator cal2; labelHeight = cal2.EvalFormula(pattern->DataVariables(), labelData.GetLabelHeight()); + labelHeight = ToPixel(labelHeight, *pattern->GetPatternUnit()); } catch(qmu::QmuParserError &e) { @@ -151,11 +153,7 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat try { const auto centerPinPoint = pattern->GeometricObject(centerPin); - - const qreal lWidth = ToPixel(labelWidth, *pattern->GetPatternUnit()); - const qreal lHeight = ToPixel(labelHeight, *pattern->GetPatternUnit()); - - pos = static_cast(*centerPinPoint) - QRectF(0, 0, lWidth, lHeight).center(); + pos = static_cast(*centerPinPoint) - QRectF(0, 0, labelWidth, labelHeight).center(); } catch(const VExceptionBadId &) { @@ -679,9 +677,6 @@ void VLayoutPiece::SetPieceText(const QString& qsName, const VPieceLabelData& da return; } - labelWidth = ToPixel(labelWidth, *pattern->GetPatternUnit()); - labelHeight = ToPixel(labelHeight, *pattern->GetPatternUnit()); - QVector v; v << ptPos << QPointF(ptPos.x() + labelWidth, ptPos.y()) @@ -740,9 +735,6 @@ void VLayoutPiece::SetPatternInfo(VAbstractPattern* pDoc, const VPatternLabelDat return; } - labelWidth = ToPixel(labelWidth, *pattern->GetPatternUnit()); - labelHeight = ToPixel(labelHeight, *pattern->GetPatternUnit()); - QVector v; v << ptPos << QPointF(ptPos.x() + labelWidth, ptPos.y())