diff --git a/src/app/puzzle/scene/vpgraphicspiece.cpp b/src/app/puzzle/scene/vpgraphicspiece.cpp index 2571b0522..2ef608c4c 100644 --- a/src/app/puzzle/scene/vpgraphicspiece.cpp +++ b/src/app/puzzle/scene/vpgraphicspiece.cpp @@ -368,40 +368,46 @@ void VPGraphicsPiece::PaintPiece(QPainter *painter) } // initialises the seam line - QVector seamLinePoints = piece->GetMappedContourPoints(); - if(!seamLinePoints.isEmpty()) + if (not piece->IsHideMainPath() || not piece->IsSeamAllowance()) { - m_seamLine.moveTo(seamLinePoints.first()); - for (int i = 1; i < seamLinePoints.size(); i++) + QVector seamLinePoints = piece->GetMappedContourPoints(); + if(!seamLinePoints.isEmpty()) { - m_seamLine.lineTo(seamLinePoints.at(i)); - } + m_seamLine.moveTo(seamLinePoints.first()); + for (int i = 1; i < seamLinePoints.size(); i++) + { + m_seamLine.lineTo(seamLinePoints.at(i)); + } - if (painter != nullptr) - { - painter->save(); - painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush); - painter->drawPath(m_seamLine); - painter->restore(); + if (painter != nullptr) + { + painter->save(); + painter->setBrush(piece->IsSelected() ? selectionBrush : noBrush); + painter->drawPath(m_seamLine); + painter->restore(); + } } } // initiliases the cutting line - QVector cuttingLinepoints = piece->GetMappedSeamAllowancePoints(); - if(!cuttingLinepoints.isEmpty()) + if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn()) { - m_cuttingLine.moveTo(cuttingLinepoints.first()); - for (int i = 1; i < cuttingLinepoints.size(); i++) + QVector cuttingLinepoints = piece->GetMappedSeamAllowancePoints(); + if(!cuttingLinepoints.isEmpty()) { - m_cuttingLine.lineTo(cuttingLinepoints.at(i)); - } + m_cuttingLine.moveTo(cuttingLinepoints.first()); + for (int i = 1; i < cuttingLinepoints.size(); i++) + { + m_cuttingLine.lineTo(cuttingLinepoints.at(i)); + } - if (painter != nullptr) - { - painter->save(); - painter->setBrush(isSelected() ? selectionBrush : noBrush); - painter->drawPath(m_cuttingLine); - painter->restore(); + if (painter != nullptr) + { + painter->save(); + painter->setBrush(isSelected() ? selectionBrush : noBrush); + painter->drawPath(m_cuttingLine); + painter->restore(); + } } } diff --git a/src/app/puzzle/scene/vpmaingraphicsview.cpp b/src/app/puzzle/scene/vpmaingraphicsview.cpp index 3bf81f7ce..f42fcbca9 100644 --- a/src/app/puzzle/scene/vpmaingraphicsview.cpp +++ b/src/app/puzzle/scene/vpmaingraphicsview.cpp @@ -756,5 +756,7 @@ void VPMainGraphicsView::on_PieceSheetChanged(const VPPiecePtr &piece) scene()->addItem(graphicsPiece); } + m_rotationControls->on_UpdateControls(); + VMainGraphicsView::NewSceneRect(scene(), this); } diff --git a/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp b/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp index 156c950ac..009654ca4 100644 --- a/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp +++ b/src/app/puzzle/undocommands/vpundomovepieceonsheet.cpp @@ -111,6 +111,11 @@ void VPUndoMovePieceOnSheet::redo() { piece->SetSheet(sourceSheet); + if (sourceSheet.isNull()) + { + piece->SetSelected(false); + } + if (m_followGrainline) { VPTransformationOrigon origin; diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index b2e3771d4..8e1290d16 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -515,8 +515,10 @@ void VPMainWindow::InitPropertyTabCurrentPiece() VPPiecePtr selectedPiece = selectedPieces.first(); if (not selectedPiece.isNull()) { -// selectedPiece->SetShowSeamline(checked); -// LayoutWasSaved(false); + selectedPiece->SetHideMainPath(not checked); + LayoutWasSaved(false); + // nothing changed, but will force redraw + emit m_layout->PieceTransformationChanged(selectedPiece); } } }); @@ -929,7 +931,7 @@ void VPMainWindow::SetPropertyTabCurrentPieceData() SetPlainTextEditValue(ui->plainTextEditCurrentPieceUUID, selectedPiece->GetUUID().toString()); SetLineEditValue(ui->lineEditCurrentPieceGradationId, selectedPiece->GetGradationId()); -// SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, selectedPiece->GetShowSeamLine()); + SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, not selectedPiece->IsHideMainPath()); SetCheckBoxValue(ui->checkBoxCurrentPieceMirrorPiece, selectedPiece->IsMirror()); if (not ui->checkBoxRelativeTranslation->isChecked()) diff --git a/src/app/puzzle/xml/vplayoutfilereader.cpp b/src/app/puzzle/xml/vplayoutfilereader.cpp index 19b0e8d84..75f50fd7f 100644 --- a/src/app/puzzle/xml/vplayoutfilereader.cpp +++ b/src/app/puzzle/xml/vplayoutfilereader.cpp @@ -440,9 +440,7 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece) piece->SetName(ReadAttributeEmptyString(attribs, ML::AttrGradationLabel)); piece->SetCopyNumber(static_cast(ReadAttributeUInt(attribs, ML::AttrCopyNumber, QChar('1')))); - -// bool showSeamline = ReadAttributeBool(attribs, ML::AttrShowSeamline, trueStr); -// piece->SetShowSeamLine(showSeamline); + piece->SetHideMainPath(not ReadAttributeBool(attribs, ML::AttrShowSeamline, trueStr)); bool pieceMirrored = ReadAttributeBool(attribs, ML::AttrMirrored, falseStr); piece->SetMirror(pieceMirrored); diff --git a/src/app/puzzle/xml/vplayoutfilewriter.cpp b/src/app/puzzle/xml/vplayoutfilewriter.cpp index 03712d8cb..2588e7336 100644 --- a/src/app/puzzle/xml/vplayoutfilewriter.cpp +++ b/src/app/puzzle/xml/vplayoutfilewriter.cpp @@ -251,6 +251,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) SetAttributeOrRemoveIf(ML::AttrGradationLabel, piece->GetGradationId(), [](const QString &label){return label.isEmpty();}); SetAttribute(ML::AttrCopyNumber, piece->CopyNumber()); + SetAttributeOrRemoveIf(ML::AttrShowSeamline, not piece->IsHideMainPath(), [](bool show){return show;}); writeStartElement(ML::TagSeamLine); writeCharacters(PathToString(piece->GetContourPoints())); diff --git a/src/libs/ifc/schema/layout/v0.1.0.xsd b/src/libs/ifc/schema/layout/v0.1.0.xsd index fa245929d..a9515c581 100644 --- a/src/libs/ifc/schema/layout/v0.1.0.xsd +++ b/src/libs/ifc/schema/layout/v0.1.0.xsd @@ -185,7 +185,8 @@ - + + @@ -325,7 +326,10 @@ - + + + +