Check if option Reverse is available.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-12-03 19:51:25 +02:00
parent 1f96114c0b
commit bf4f9a3c61
2 changed files with 4 additions and 3 deletions

View File

@ -246,7 +246,6 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
} }
QMenu *menu = new QMenu(this); QMenu *menu = new QMenu(this);
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
QListWidgetItem *rowItem = ui->listWidget->item(row); QListWidgetItem *rowItem = ui->listWidget->item(row);
SCASSERT(rowItem != nullptr); SCASSERT(rowItem != nullptr);
@ -260,13 +259,15 @@ void DialogPiecePath::ShowContextMenu(const QPoint &pos)
actionReverse->setChecked(rowNode.GetReverse()); actionReverse->setChecked(rowNode.GetReverse());
} }
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
QAction *selectedAction = menu->exec(ui->listWidget->viewport()->mapToGlobal(pos)); QAction *selectedAction = menu->exec(ui->listWidget->viewport()->mapToGlobal(pos));
if (selectedAction == actionDelete) if (selectedAction == actionDelete)
{ {
delete ui->listWidget->item(row); delete ui->listWidget->item(row);
ValidObjects(PathIsValid()); ValidObjects(PathIsValid());
} }
else if (selectedAction == actionReverse) else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse)
{ {
rowNode.SetReverse(not rowNode.GetReverse()); rowNode.SetReverse(not rowNode.GetReverse());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));

View File

@ -334,7 +334,7 @@ void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
delete ui->listWidgetMainPath->item(row); delete ui->listWidgetMainPath->item(row);
ValidObjects(MainPathIsValid()); ValidObjects(MainPathIsValid());
} }
else if (selectedAction == actionReverse) else if (rowNode.GetTypeTool() != Tool::NodePoint && selectedAction == actionReverse)
{ {
rowNode.SetReverse(not rowNode.GetReverse()); rowNode.SetReverse(not rowNode.GetReverse());
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));