diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index a0cf4dbc4..4d6dc84a7 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -244,8 +244,8 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer { VLayoutPassmark layoutPassmark; - VPiecePath path = piece.GetPath(); - const int nodeIndex = path.indexOfNode(pData.id); + const QVector path = piece.GetUnitedPath(pattern); + const int nodeIndex = VPiecePath::indexOfNode(path, pData.id); if (nodeIndex != -1) { layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern); @@ -255,14 +255,21 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer layoutPassmarks.append(layoutPassmark); } + else + { + const QString errorMsg = + QObject::tr("Passmark '%1' is not part of piece '%2'.") + .arg(pData.nodeName, piece.GetName()); + qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg; + } }; auto PrepareSAPassmark = [pData, passmark, piece, &layoutPassmarks, pattern](PassmarkSide side) { VLayoutPassmark layoutPassmark; - VPiecePath path = piece.GetPath(); - const int nodeIndex = path.indexOfNode(pData.id); + const QVector path = piece.GetUnitedPath(pattern); + const int nodeIndex = VPiecePath::indexOfNode(path, pData.id); if (nodeIndex != -1) { QVector lines = @@ -282,6 +289,13 @@ QVector ConvertPassmarks(const VPiece &piece, const VContainer layoutPassmarks.append(layoutPassmark); } + else + { + const QString errorMsg = + QObject::tr("Passmark '%1' is not part of piece '%2'.") + .arg(pData.nodeName, piece.GetName()); + qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg; + } }; if (not piece.IsSeamAllowanceBuiltIn())