diff --git a/ChangeLog.txt b/ChangeLog.txt index 324834f38..2aae3c440 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,6 @@ # Version 0.7.0 (unreleased) - [#892] Show tooltip for piece node point. +- [#894] Quick way to disable a passmark. # Version 0.6.1 (unreleased) - [#885] Regression. Broken support for multi size measurements. diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp index f60b9fa97..38c0ee385 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp @@ -283,6 +283,9 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) actionShowLabel->setCheckable(true); actionShowLabel->setChecked(VAbstractTool::data.GeometricObject(m_id)->IsShowLabel()); + QAction *actionPassmark = menu.addAction(tr("Passmark")); + actionPassmark->setCheckable(true); + QAction *actionExclude = menu.addAction(tr("Exclude")); QMenu *angleTypeMenu = menu.addMenu(tr("Angle")); @@ -294,10 +297,14 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { const VPieceNode &node = detail.GetPath().at(nodeIndex); curType = node.GetAngleType(); + + actionPassmark->setChecked(node.IsPassmark()); + actionPassmark->setVisible(node.IsPassmark()); } else { angleTypeMenu->setVisible(false); + actionPassmark->setVisible(false); } auto InitAngleAction = [angleTypeMenu, curType](const QString &name, PieceNodeAngle checkType) @@ -421,6 +428,10 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) emit ToggleAngleType(m_id, PieceNodeAngle::BySecondEdgeRightAngle); } } + else if (selectedAction == actionPassmark) + { + emit TogglePassmark(m_id, false); + } } } diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.h b/src/libs/vtools/tools/nodeDetails/vnodepoint.h index 2b23680ab..c38f41067 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.h +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.h @@ -67,6 +67,7 @@ signals: void Delete(); void ToggleExcludeState(quint32 id); void ToggleAngleType(quint32 id, PieceNodeAngle type); + void TogglePassmark(quint32 id, bool toggle); public slots: virtual void FullUpdateFromFile() override; void NameChangePosition(const QPointF &pos); diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 44f8f10fd..595158577 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1544,6 +1544,26 @@ void VToolSeamAllowance::ToggleNodePointAngleType(quint32 id, PieceNodeAngle typ } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSeamAllowance::ToggleNodePointPassmark(quint32 id, bool toggle) +{ + const VPiece oldDet = VAbstractTool::data.GetPiece(m_id); + VPiece newDet = oldDet; + + for (int i = 0; i< oldDet.GetPath().CountNodes(); ++i) + { + VPieceNode node = oldDet.GetPath().at(i); + if (node.GetId() == id && node.GetTypeTool() == Tool::NodePoint) + { + node.SetPassmark(toggle); + newDet.GetPath()[i] = node; + + qApp->getUndoStack()->push(new SavePieceOptions(oldDet, newDet, doc, m_id)); + return; + } + } +} + //--------------------------------------------------------------------------------------------------------------------- VPieceItem::MoveTypes VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, qreal &rotationAngle, qreal &labelWidth, qreal &labelHeight, QPointF &pos) @@ -1771,6 +1791,8 @@ void VToolSeamAllowance::InitNode(const VPieceNode &node, VMainGraphicsScene *sc Qt::UniqueConnection); connect(tool, &VNodePoint::ToggleAngleType, parent, &VToolSeamAllowance::ToggleNodePointAngleType, Qt::UniqueConnection); + connect(tool, &VNodePoint::TogglePassmark, parent, &VToolSeamAllowance::ToggleNodePointPassmark, + Qt::UniqueConnection); connect(tool, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem, Qt::UniqueConnection); tool->setParentItem(parent); tool->SetParentType(ParentType::Item); diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index cb9644e7a..bd2944373 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -167,6 +167,7 @@ private slots: void DeleteFromMenu(); void ToggleExcludeState(quint32 id); void ToggleNodePointAngleType(quint32 id, PieceNodeAngle type); + void ToggleNodePointPassmark(quint32 id, bool toggle); private: Q_DISABLE_COPY(VToolSeamAllowance) diff --git a/src/libs/vtools/undocommands/savepieceoptions.cpp b/src/libs/vtools/undocommands/savepieceoptions.cpp index 41972e3c6..45a322bef 100644 --- a/src/libs/vtools/undocommands/savepieceoptions.cpp +++ b/src/libs/vtools/undocommands/savepieceoptions.cpp @@ -184,7 +184,8 @@ bool SavePieceOptions::mergeWith(const QUndoCommand *command) for (int i = 0; i < nodes.size(); ++i) { if (nodes.at(i).IsExcluded() != candidateNodes.at(i).IsExcluded() - || nodes.at(i).IsCheckUniqueness() != candidateNodes.at(i).IsCheckUniqueness()) + || nodes.at(i).IsCheckUniqueness() != candidateNodes.at(i).IsCheckUniqueness() + || nodes.at(i).IsPassmark() != candidateNodes.at(i).IsPassmark()) { return false; }