Show warning when a layout allowance is smaller than main piece path. This is
usually idicates issue with seam allowance. ref #782. --HG-- branch : develop
This commit is contained in:
parent
15c93854d8
commit
850bb88c6b
|
@ -742,7 +742,13 @@ QVector<VLayoutPiece> MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quin
|
||||||
{
|
{
|
||||||
VAbstractTool *tool = qobject_cast<VAbstractTool*>(VAbstractPattern::getTool(i.key()));
|
VAbstractTool *tool = qobject_cast<VAbstractTool*>(VAbstractPattern::getTool(i.key()));
|
||||||
SCASSERT(tool != nullptr)
|
SCASSERT(tool != nullptr)
|
||||||
listDetails.append(VLayoutPiece::Create(i.value(), tool->getData()));
|
const VLayoutPiece piece = VLayoutPiece::Create(i.value(), tool->getData());
|
||||||
|
if (not piece.IsLayoutAllowanceValid())
|
||||||
|
{
|
||||||
|
qWarning()<< tr("Piece '%1' may broke a layout. Please, check seam allowance to check how seam "
|
||||||
|
"allowance behave.").arg(piece.GetName());
|
||||||
|
}
|
||||||
|
listDetails.append(piece);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1055,6 +1055,21 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VLayoutPiece::IsLayoutAllowanceValid() const
|
||||||
|
{
|
||||||
|
QVector<QPointF> piecePath;
|
||||||
|
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn())
|
||||||
|
{
|
||||||
|
piecePath = d->seamAllowance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
piecePath = d->contour;
|
||||||
|
}
|
||||||
|
return qFloor(qAbs(SumTrapezoids(d->layoutAllowance)/2.0)) >= qFloor(qAbs(SumTrapezoids(piecePath)/2.0));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape,
|
void VLayoutPiece::CreateLabelStrings(QGraphicsItem *parent, const QVector<QPointF> &labelShape,
|
||||||
const VTextManager &tm, bool textAsPaths) const
|
const VTextManager &tm, bool textAsPaths) const
|
||||||
|
|
|
@ -138,6 +138,8 @@ public:
|
||||||
QPainterPath LayoutAllowancePath() const;
|
QPainterPath LayoutAllowancePath() const;
|
||||||
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
Q_REQUIRED_RESULT QGraphicsItem *GetItem(bool textAsPaths) const;
|
||||||
|
|
||||||
|
bool IsLayoutAllowanceValid() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VLayoutPieceData> d;
|
QSharedDataPointer<VLayoutPieceData> d;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user