From 56e05ab953a44025a8704c4e5abcb72bce1a4147 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 24 Sep 2018 14:40:02 +0300 Subject: [PATCH] Improve context menu in dialog piece path. This menu should povide exclude option. Also Passmark option should be available only when a piece path included as main path. --HG-- branch : release --- .../dialogs/tools/piece/dialogpiecepath.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index 88d882ebf..91f0c5a95 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -313,7 +313,8 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos) } else { - if (m_showMode && GetType() == PiecePathType::CustomSeamAllowance) + if (m_showMode && GetType() == PiecePathType::CustomSeamAllowance + && ui->tabWidget->indexOf(ui->tabPassmarks) != -1) { actionPassmark = menu->addAction(tr("Passmark")); actionPassmark->setCheckable(true); @@ -325,6 +326,10 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos) actionUniqueness->setChecked(rowNode.IsCheckUniqueness()); } + QAction *actionExcluded = menu->addAction(tr("Excluded")); + actionExcluded->setCheckable(true); + actionExcluded->setChecked(rowNode.IsExcluded()); + QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); QAction *selectedAction = menu->exec(ui->listWidget->viewport()->mapToGlobal(pos)); @@ -338,13 +343,22 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos) rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setText(GetNodeName(rowNode, IsShowNotch())); } - else if (m_showMode && selectedAction == actionPassmark && GetType() == PiecePathType::CustomSeamAllowance) + else if (m_showMode && rowNode.GetTypeTool() == Tool::NodePoint && selectedAction == actionPassmark + && GetType() == PiecePathType::CustomSeamAllowance + && ui->tabWidget->indexOf(ui->tabPassmarks) != -1) { rowNode.SetPassmark(not rowNode.IsPassmark()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setText(GetNodeName(rowNode, IsShowNotch())); } - else if (selectedAction == actionUniqueness) + else if (selectedAction == actionExcluded) + { + rowNode.SetExcluded(not rowNode.IsExcluded()); + rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); + rowItem->setText(GetNodeName(rowNode, true)); + rowItem->setFont(NodeFont(rowItem->font(), rowNode.IsExcluded())); + } + else if (rowNode.GetTypeTool() == Tool::NodePoint && selectedAction == actionUniqueness) { rowNode.SetCheckUniqueness(not rowNode.IsCheckUniqueness()); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));