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(node.GetId() > NULL_ID);
@ -687,7 +687,7 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node)
case (Tool::NodeElArc):
case (Tool::NodeSpline):
case (Tool::NodeSplinePath):
name = GetNodeName(node, true);
name = GetNodeName(node, showPassmark);
break;
default:
qDebug()<<"Got wrong tools. Ignore.";

View file

@ -285,7 +285,7 @@ protected:
static QFont NodeFont(QFont font, bool nodeExcluded = false);
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);
private:

View file

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