Improve Piece Path dialog. Hide posibility to enable passmark for internal path.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-07-22 11:31:57 +03:00
parent 29a9b00ec7
commit 9d778378d8
3 changed files with 16 additions and 13 deletions

View File

@ -675,7 +675,7 @@ QString DialogTool::GetNodeName(const VPieceNode &node, bool showPassmark) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node) void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node, bool showPassmark)
{ {
SCASSERT(listWidget != nullptr); SCASSERT(listWidget != nullptr);
SCASSERT(node.GetId() > NULL_ID); SCASSERT(node.GetId() > NULL_ID);
@ -687,7 +687,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
case (Tool::NodeElArc): case (Tool::NodeElArc):
case (Tool::NodeSpline): case (Tool::NodeSpline):
case (Tool::NodeSplinePath): case (Tool::NodeSplinePath):
name = GetNodeName(node, true); name = GetNodeName(node, showPassmark);
break; break;
default: default:
qDebug()<<"Got wrong tools. Ignore."; qDebug()<<"Got wrong tools. Ignore.";

View File

@ -285,7 +285,7 @@ protected:
static QFont NodeFont(QFont font, bool nodeExcluded = false); static QFont NodeFont(QFont font, bool nodeExcluded = false);
QString GetNodeName(const VPieceNode &node, bool showPassmark = false) const; QString GetNodeName(const VPieceNode &node, bool showPassmark = false) const;
void NewNodeItem(QListWidget *listWidget, const VPieceNode &node); void NewNodeItem(QListWidget *listWidget, const VPieceNode &node, bool showPassmark = true);
void InitNodeAngles(QComboBox *box); void InitNodeAngles(QComboBox *box);
private: private:

View File

@ -290,9 +290,12 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
} }
else else
{ {
actionPassmark = menu->addAction(tr("Passmark")); if (GetType() == PiecePathType::CustomSeamAllowance)
actionPassmark->setCheckable(true); {
actionPassmark->setChecked(rowNode.IsPassmark()); actionPassmark = menu->addAction(tr("Passmark"));
actionPassmark->setCheckable(true);
actionPassmark->setChecked(rowNode.IsPassmark());
}
actionUniqueness = menu->addAction(tr("Check uniqueness")); actionUniqueness = menu->addAction(tr("Check uniqueness"));
actionUniqueness->setCheckable(true); actionUniqueness->setCheckable(true);
@ -310,19 +313,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, true)); rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance));
} }
else if (selectedAction == actionPassmark) else if (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, true)); rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance));
} }
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, true)); rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance));
} }
ValidObjects(PathIsValid()); ValidObjects(PathIsValid());
@ -594,7 +597,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, true)); rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance));
ListChanged(); ListChanged();
} }
@ -648,7 +651,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, true)); rowItem->setText(GetNodeName(rowNode, GetType() == PiecePathType::CustomSeamAllowance));
ListChanged(); ListChanged();
} }
@ -1380,7 +1383,7 @@ void DialogPiecePath::ValidObjects(bool value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogPiecePath::NewItem(const VPieceNode &node) void DialogPiecePath::NewItem(const VPieceNode &node)
{ {
NewNodeItem(ui->listWidget, node); NewNodeItem(ui->listWidget, node, GetType() == PiecePathType::CustomSeamAllowance);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------