Valentina doesn't allow to continue creating a customer seam allowance after

calling a context menu.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-07-24 10:09:00 +03:00
parent fdd609f8a2
commit 16d8c5fc65
2 changed files with 25 additions and 12 deletions

View File

@ -200,16 +200,22 @@ void DialogPiecePath::ShowDialog(bool click)
void DialogPiecePath::CheckState() void DialogPiecePath::CheckState()
{ {
SCASSERT(bOk != nullptr); SCASSERT(bOk != nullptr);
if (GetType() != PiecePathType::InternalPath) if (GetType() == PiecePathType::InternalPath)
{// Works only for internal paths
m_flagFormulaVisible = true;
}
else
{ {
flagFormula = true; flagFormula = true;
m_flagFormulaBefore = true; m_flagFormulaBefore = true;
m_flagFormulaAfter = true; m_flagFormulaAfter = true;
} }
else
{
m_flagFormulaVisible = true; // Works only for internal paths
if (not m_showMode)
{
flagFormula = true;
m_flagFormulaBefore = true;
m_flagFormulaAfter = true;
}
}
bOk->setEnabled(flagName && flagError && flagFormula && m_flagFormulaBefore && m_flagFormulaAfter bOk->setEnabled(flagName && flagError && flagFormula && m_flagFormulaBefore && m_flagFormulaAfter
&& m_flagFormulaVisible); && m_flagFormulaVisible);
@ -290,7 +296,7 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
} }
else else
{ {
if (GetType() == PiecePathType::CustomSeamAllowance) if (m_showMode && GetType() == PiecePathType::CustomSeamAllowance)
{ {
actionPassmark = menu->addAction(tr("Passmark")); actionPassmark = menu->addAction(tr("Passmark"));
actionPassmark->setCheckable(true); actionPassmark->setCheckable(true);
@ -313,19 +319,19 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
{ {
rowNode.SetReverse(not rowNode.GetReverse()); rowNode.SetReverse(not rowNode.GetReverse());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance)); rowItem->setText(GetNodeName(rowNode, IsShowNotch()));
} }
else if (selectedAction == actionPassmark && GetType() == PiecePathType::CustomSeamAllowance) else if (m_showMode && selectedAction == actionPassmark && GetType() == PiecePathType::CustomSeamAllowance)
{ {
rowNode.SetPassmark(not rowNode.IsPassmark()); rowNode.SetPassmark(not rowNode.IsPassmark());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance)); rowItem->setText(GetNodeName(rowNode, IsShowNotch()));
} }
else if (selectedAction == actionUniqueness) else if (selectedAction == actionUniqueness)
{ {
rowNode.SetCheckUniqueness(not rowNode.IsCheckUniqueness()); rowNode.SetCheckUniqueness(not rowNode.IsCheckUniqueness());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance)); rowItem->setText(GetNodeName(rowNode, IsShowNotch()));
} }
ValidObjects(PathIsValid()); ValidObjects(PathIsValid());
@ -597,7 +603,7 @@ void DialogPiecePath::PassmarkLineTypeChanged(int id)
rowNode.SetPassmarkLineType(lineType); rowNode.SetPassmarkLineType(lineType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance)); rowItem->setText(GetNodeName(rowNode, IsShowNotch()));
ListChanged(); ListChanged();
} }
@ -651,7 +657,7 @@ void DialogPiecePath::PassmarkAngleTypeChanged(int id)
rowNode.SetPassmarkAngleType(angleType); rowNode.SetPassmarkAngleType(angleType);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance)); rowItem->setText(GetNodeName(rowNode, IsShowNotch()));
ListChanged(); ListChanged();
} }

View File

@ -158,6 +158,13 @@ private:
QString GetFormulaVisible() const; QString GetFormulaVisible() const;
void SetFormulaVisible(const QString &formula); void SetFormulaVisible(const QString &formula);
bool IsShowNotch() const;
}; };
inline bool DialogPiecePath::IsShowNotch() const
{
return m_showMode && GetType() == PiecePathType::CustomSeamAllowance;
}
#endif // DIALOGPIECEPATH_H #endif // DIALOGPIECEPATH_H