issue 826 improvement to be able to add

--HG--
branch : feature
This commit is contained in:
Ronan Le Tiec 2018-03-29 23:13:33 +02:00
parent 67c0e7ed45
commit 597f021139
2 changed files with 10 additions and 3 deletions

View File

@ -146,6 +146,13 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
return;
}
GOType itemType = GOType::Unknown;
if(itemId != NULL_ID)
{
const auto obj = data.GetGObject(itemId);
itemType = obj->getType();
}
qCDebug(vTool, "Creating tool context menu.");
QMenu menu;
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
@ -193,10 +200,10 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
}
}
QAction *actionShowLabel = menu.addAction(tr("Show label"));
actionShowLabel->setCheckable(true);
if (itemId != NULL_ID)
if (itemType == GOType::Point)
{
actionShowLabel->setChecked(IsLabelVisible(itemId));
}

View File

@ -155,7 +155,7 @@ QVariant VSimpleCurve::itemChange(QGraphicsItem::GraphicsItemChange change, cons
//---------------------------------------------------------------------------------------------------------------------
void VSimpleCurve::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
emit ShowContextMenu(event);
emit ShowContextMenu(event, id);
}
//---------------------------------------------------------------------------------------------------------------------