GraphViewer: added Show/Hide global path

This commit is contained in:
matlabbe
2015-05-08 14:13:53 -04:00
parent 7aaa4698d5
commit aa8aeed9d2
+17
View File
@@ -868,6 +868,7 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
QAction * aShowHideOrigin; QAction * aShowHideOrigin;
QAction * aShowHideReferential; QAction * aShowHideReferential;
QAction * aShowHideLocalRadius; QAction * aShowHideLocalRadius;
QAction * aClearGlobalPath;
if(_gridMap->isVisible()) if(_gridMap->isVisible())
{ {
aShowHideGridMap = menu.addAction(tr("Hide grid map")); aShowHideGridMap = menu.addAction(tr("Hide grid map"));
@@ -900,6 +901,15 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
{ {
aShowHideLocalRadius = menu.addAction(tr("Show local radius")); aShowHideLocalRadius = menu.addAction(tr("Show local radius"));
} }
if(_globalPathLinkItems.size() && _globalPathLinkItems.begin().value()->isVisible())
{
aClearGlobalPath = menu.addAction(tr("Hide global path"));
}
else
{
aClearGlobalPath = menu.addAction(tr("Show global path"));
}
aClearGlobalPath->setEnabled(_globalPathLinkItems.size());
menu.addSeparator(); menu.addSeparator();
QAction * aRestoreDefaults = menu.addAction(tr("Restore defaults")); QAction * aRestoreDefaults = menu.addAction(tr("Restore defaults"));
@@ -1097,6 +1107,13 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
{ {
this->restoreDefaults(); this->restoreDefaults();
} }
else if(r == aClearGlobalPath)
{
for(QMap<int, LinkItem*>::iterator iter=_globalPathLinkItems.begin(); iter!=_globalPathLinkItems.end(); ++iter)
{
iter.value()->setVisible(!iter.value()->isVisible());
}
}
if(r) if(r)
{ {
emit configChanged(); emit configChanged();