Resolved issue #894. Quick way to disable a passmark.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-10-22 15:06:32 +03:00
parent 1d0b5790ae
commit 9f2959e32e
6 changed files with 38 additions and 1 deletions

View File

@ -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.

View File

@ -283,6 +283,9 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
actionShowLabel->setCheckable(true);
actionShowLabel->setChecked(VAbstractTool::data.GeometricObject<VPointF>(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);
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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;
}